【发布时间】:2012-03-03 01:12:07
【问题描述】:
HTML
<tr url="domain.com">
<td><input type="checkbox" name="checkbox[]" method="post" value="" class="checkbox" /> </td>
</tr>
JS
$("tr").not('.checkbox').click(function(){
window.location = $(this).attr("url");
});
想要禁用点击框内的点击功能,但上面的代码不起作用:即使我点击复选框,它也会重定向。我哪里做错了?
【问题讨论】:
-
我建议您使用
data-语法。<tr data-custom-url="http://domain.com">并以$("selector").data("custom-url");访问它。顺便说一句,如果我没记错的话,你还必须指出 url 的协议。
标签: javascript jquery html html-table tablerow