javascript - If state of checkbox was changed can it be permanently saved on page? -


if checkbox checked/unchacked want save state permanently on page. try smth this:

function savestate() {         document.getelementbyid($(this).parent().attr('id')).innerhtml = '<input type="checkbox" checked onclick="savestate.call(this)">'     } 

and

<td id="test"> <input type="checkbox" onclick="savestate.call(this)"> </td> 

but after page refresh changes missed.

you have 2 options data persist across page loads:

  1. save server-side
  2. save client-side

using local storage quickest client-side option:

localstorage.setitem("state", savestate()); // save localstorage.getitem("state") // 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -