这是我的代码,我想点击按钮时收听广播的响应.
<table class='x'>
<tr><td><input type="radio"></td></tr>
<tr><td><input type="text"></td></tr>
</table>
<input type='button' id="a" value="dfrfvrgv">
Run Code Online (Sandbox Code Playgroud)
这是jQuery代码
$('#a').click(function()
{
$('TABLE .x').find('input').removeAttr('checked');
});
Run Code Online (Sandbox Code Playgroud)
但它不起作用,似乎是代码的问题.请有人帮助我.
对于jquery <3.0:
$('#a').click(function() {
$('TABLE.x').find('input').removeAttr('checked');
});
Run Code Online (Sandbox Code Playgroud)
对于jquery> = 3.0:
$('#a').click(function() {
$('TABLE.x').find('input').prop('checked', false);
});
// More info about removeAttr and prop you can find here https://stackoverflow.com/questions/6169826/propchecked-false-or-removeattrchecked
Run Code Online (Sandbox Code Playgroud)
选择器中没有空格
你在那里寻找空间,是TABLE的任何子节点都有x类.table.x查找类为x的表.
| 归档时间: |
|
| 查看次数: |
26438 次 |
| 最近记录: |