我想做的是能够突出显示我已经完成的所选单选按钮的父级。我遇到的问题是从未选择的收音机中删除 .sel 类。我将在一个表中设置多个无线电组,每行一组。
这是我到目前为止的代码:
$(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');
}
});
});
我在这里设置了一个 jsFiddle,其中包含我迄今为止所管理的内容:http: //jsfiddle.net/ASMITH/drYTP/5/