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:
- save server-side
- save client-side
using local storage quickest client-side option:
localstorage.setitem("state", savestate()); // save localstorage.getitem("state") //
Comments
Post a Comment