Changing cell class on radio button change
Posted
by
Nick
on Stack Overflow
See other posts from Stack Overflow
or by Nick
Published on 2011-01-07T11:39:53Z
Indexed on
2011/01/07
11:54 UTC
Read the original article
Hit count: 168
jQuery
|radio-button
Huge thanks for the help in this thread - Click td, select radio button in jQuery
But now I'm having trouble that it won't change the class of the cell, even though I have binded the 'change' trigger in jQuery like so:
$("td input[type=radio]").bind('change click', function () {
$('td').removeClass('selected');
$(this).parent('td').addClass('selected');
});
$("td").click(function () {
$('input:radio', this).attr('checked', true);
});
Hope that makes sense. If you click the radio button, or move between them using the keyboard, the cell's class changes just fine. However if you trigger this by clicking the cell it doesn't change the class :(
Thanks
© Stack Overflow or respective owner