javascript - Change checkbox status on click is not being displayed -


checkbox status values stored in localstorage. 'updatestorage' sets these key value pairs 'null' in localstorage.

the effect seen after page reload. how can achieve change of checkbox status displayed directly, such in toggle, after function invoked ?

d3.select("#update").on("click",updatestorage);   function updatestorage(){  var updatethis = d3.selectall(".box").each(function(){  var use_it = this.id;  localstorage.setitem(use_it,null); d3.select(this).property('checked', null); //does not change display directly  }); }; 

adding line did not help

     d3.select(this).property('checked', null); 

do need transition ??

for solved this:

d3.select("#update").on("click",updatestorage);   function updatestorage(){  var updatethis = d3.selectall(".box").filter(":checked").each(function(){  var use_it = this.id; console.log("updatethisid :" + use_it); d3.selectall('.box').property('checked', false); localstorage.setitem(use_it,null);   }); }; 

i not sure why cannot select boxes d3.select(this) same effect. - ?

i added filter pseudo :checked select checked boxes only.


Comments