Jquery 复选框在onClick或onChange时不触发事件
我不知道为什么我的复选框没有在jQuery上触发事件。 以下是我的表格结构:Jquery 复选框在onClick或onChange时不触发事件,jquery,checkbox,Jquery,Checkbox,我不知道为什么我的复选框没有在jQuery上触发事件。 以下是我的表格结构: div id=example1 --table --tr --td + icon to check line item --td setOff select box --td checkbox class="fill" 我正在这样做: jQuery('#example1').on('click','.fill',function(){ alert($(this).is(
div id=example1
--table
--tr
--td + icon to check line item
--td setOff select box
--td checkbox class="fill"
我正在这样做:
jQuery('#example1').on('click','.fill',function(){
alert($(this).is(":checked"));
});
但它不工作,它不会发出警报(Hello),我也尝试过一次更改,但仍然没有警报
我可以在控制台中打印Hello,但无法发出警报如果您已经在使用jQuery,则可以使用单击功能。 假设这是你的桌子
<div id='example1'>
<table>
<thead>
<tr><th></th><th>Row Text</th></tr>
</thead>
<tr>
<td class='fill'><input type="checkbox" /></td>
<td>Test</td>
</tr>
</table>
</div>
如果您已经在使用jQuery,那么可以使用click函数。 假设这是你的桌子
<div id='example1'>
<table>
<thead>
<tr><th></th><th>Row Text</th></tr>
</thead>
<tr>
<td class='fill'><input type="checkbox" /></td>
<td>Test</td>
</tr>
</table>
</div>
请确保您是否包含jquery库??是否包含jquery库??是否包含jquery库??是否包含jquery库??是否包含jquery库??是否包含jquery库??是否包含jquery库??是否包含其他事件是否包含jquery库??是否包含其他事件是否包含jquery库??是否包含jquery库??是否包含其他事件是否包含jquery库??是否包含jquery库??是否包含其他事件我也尝试过这种方法,但不起作用我正在尝试()因为行是动态生成的我也在尝试,但不起作用我在尝试()因为行是动态生成的我也在尝试,但不起作用我在尝试()因为行是动态生成的