jquery - Remove class from parent <td> of unselected radio buttons -
what able highlight parent of selected radio button, have done. thing having trouble removing .sel class unselected radios. have multiple radio groups set in table, 1 group each row.
here code now:
$(document).ready(function () { $('td.radio').click(function () { $(this).children('input').prop('checked', true); if ($(this).children('input').is(':checked')) { $(this).addclass('sel'); } else { $(this).removeclass('sel'); } }); });
i have jsfiddle set here have managed far: http://jsfiddle.net/asmith/drytp/5/
remove sel class siblings of td clicked, add 1 clicked:
$('td.radio').click(function () { var $this = $(this); $this.children('input').prop('checked', true); $this.siblings('td').removeclass('sel'); $this.addclass('sel'); });
Comments
Post a Comment