In my table, I have radio buttons that should turn the neighboring cell green when clicked. Using JQuery, I added a "highlight" class on $.change event to achieve this effect.
However, I encountered an issue where some radio buttons load with the "checked" attribute already set. How can I use JQuery to find all radio button elements with the "checked" attribute upon page load? Below is my attempt, which doesn't seem to work as expected.
JQUERY
$('input:radio').ready(function() {
if($(this).is(':checked')){
$(this).parent().addClass('highlight');
var $td = $(this).parent();
$td.siblings().removeClass('highlight');
$td.next().addClass('highlight');
}
});
CSS
#sort td.highlight {background: #33FF99;}