0

How is it possible to refresh a page/checkbox after changing the value via javascript. My App reads a boolean value from the localstorage and check or uncheck the checkbox.

$('#settingsContent').trigger("create");
$('#settingsContent').page();

Tried this two ways but it doesn't work. Only with the page() Methode i get a white page. Only with trigger("create") nothing happens.

<div id="settingsContent"> 

Is the name of my div tag.

It is a phonegap app using jquery html etc..

EDIT

valueVar = document.getElementById(nameVar);
if (timeStamp == true) {
         valueVar.checked = true;
    } else {
         valueVar.checked = false;
    }

timeStamp is a value from my localstorage. This work's. But after this code i check or uncheck my checkbox. It work's also. I need not refresh the page? To see the checked checkboxes?

2
  • Do we have method .page() in jQuery? Commented Jul 16, 2014 at 7:40
  • You want to change checkbox value after change or reload page? Commented Jul 16, 2014 at 8:18

3 Answers 3

7

You want to reload your page after CheckBox content change?

$('#checkbox').on('change', function() {
    location.reload();
});
Sign up to request clarification or add additional context in comments.

1 Comment

No not directly, i change the value of my checkbox via javascript. so i want reload the my checkbox. with the new value.
2

You can use load of JQuery if you want to load only partial part of you DOM

   $("#settingsContent).load(url);

http://api.jquery.com/load/

Comments

0

If you want to change the HTML content of an element, you can use the following:

var newContent = "Hello";
$('#settingsContent').html(newContent);

The html() method will also take HTML syntax, not just a string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.