0
从下面的代码,我不能得到input[radio]
检查表中选定的行。以下代码使用HTML5和JQuery 1.10.2。HTML5 tr与无线电行选择
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
input[type="radio"] {
margin: 10px;
}
</style>
<script src="jquery-1.10.2.min.js" />
<script>
$(function() {
$("#table_list tr").click(function() {
$(this).find("td input:radio").prop("checked", true);
});
});
</script>
</head>
<body>
<table id="table_list">
<thead>
<th></th>
<th>Name</th>
<th>Email</th>
</thead>
<tbody>
<tr>
<td><input type="radio" name="record"/></th>
<td>Sample1</td>
<td>[email protected]</td>
</tr>
<tr>
<th><input type="radio" name="record"/></th>
<td>Sample1</td>
<td>[email protected]</td>
</tr>
</tbody>
</table>
</body>
</html>
你能提供的jsfiddle?首先,你需要给你的收音机一个价值,以便以后评估它们。 – Pouki
解决您的标记,它会工作(你有'
内''等''HTML这里固定的http:// jsbin.com/adesux/1/edit – Anton
回答
你的第一输入处于
td
,第二个是在一个th
。你必须从你的输入选择删除td
:working codepen所附的JavaScript将工作两个。另一个选择是仅改变
th
到td
并保持你的选择会是这样。注意:您在评论中提到的人有几个标记问题。 (在
thead
忘记tr
)来源
2013-08-12 09:51:54
请看看http://jsbin.com/atosaq/4/edit
来源
2013-08-12 10:04:49 vinothini
相关问题