javascript - How to uncheck check-box by clicking on item that was dynamically added with that checkbox -


i stuck problem.. general idea have check-boxes, , clicking on them, value remove button appended on div. problem can't uncheck specific check-box clicking on appended item.

here function's use appending , removing elements.

 function appendchoices() {          len = userchoices.length;          // if len === 0 no need check         if(!len) return false;          for(i = 0; < len; i++){             option        = userchoices[i];             $categorydiv  = $('#' + option.category + '-container');             $categorydiv.append('<span class="filteritemappended" data-item="'+option.value+'">'             + '<a href="#" onclick="removerecord('+ +')"><span class="glyphicon glyphicon-minus"></span></a>'             + option.value             +'</span>');              // need if reset button used             $('#checkbox-list').show();         }      }     function removerecord(i) {         $categorydiv  = $('#' + option.category + '-container');          userchoices.splice(i, 1);          (var = 0; < userchoices.length; i++) {             $categorydiv.append('<span class="filteritemappended" data-item="'+option.value+'">'             + '<a href="#" onclick="removerecord('+ +')"><span class="glyphicon glyphicon-minus"></span></a>'             + option.value             +'</span>');          };          $('input[type=checkbox]').val(option.value).prop('checked', false);          localstorage.setitem('userchoices', json.stringify(userchoices));          updatedom();          location.reload();     } 

all appreciated, thx in advance.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -