想实现点击一行中任意位置 此行的 radio 选中。
function rowClick(t) {
var id = $(t).attr("id").substr(3, 1); // 行号
$('#rad' + id).attr("checked", true);
}
这样写 发现不能正常设置,查了一会儿,没有找到好的解决办法。
document.getElementById("rad" + id).checked = true;
最后用 放弃 jquery 用 JS 写,果然正常了。不明白 jquery 怎么会这样不行,有空要去查查 源码。先记下来。