jquery - Deselect a checkbox -


im not sure why reason when click td has checkbox checked not deselect it.

$('table tr').click(function() {      checkbox = $(this).children('td').children('input[type=checkbox]');      if(checkbox.attr('checked'))         checkbox.attr('checked', '');     else         checkbox.attr('checked', 'checked'); }); 

you want:

   if(checkbox.attr('checked'))         checkbox.removeattr('checked');     else         checkbox.attr('checked', 'checked'); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -