我已经建立了它看起来像这样的功能jQuery选择:jQuery选择。不是()不工作
$('html').not('.table-main tr[selected]').mousedown(function(e) {
但不知何故,它不是在所有的过滤,我不明白为什么。 即使我只是离开('.table-main')对于选择器,我仍然在点击表格时触发该函数......这是什么问题?
使用文件或“身体”,而不是“HTML”没有帮助,因为文件是不是在所有。不触发()和“体”的结果相同。
编辑: 刚刚尝试使用表格外的另一个块,它的工作原理。有没有机会我不能在桌上使用它?
UPDATE2:按照要求,这里是表的渲染HTML代码:
<table border="0" cellspacing="2px" cellpadding="5px" class="table-main">
<tr id="tablefields">
<th style="padding: 0;">
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr><th><div class="tr-head-get" id="tr-get-0">Name</div></th></tr>
<tr><th><div class="th-header" id="th-header-0" style="top: 54px;">Name</div></th></tr>
</table>
</th>
<th style="padding: 0;"></th>
</tr>
<tr id='table_form_new_device' class='table_form_class'>
<form accept-charset="UTF-8" action="/devices" class="new_device" data-remote="true" id="new_device" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="T2dSeZpxxvgJdTP+yoE7BrVODzqJ95gyVu9Wh/v7oP8=" /></div>
<th class='tablefield'>
<input id="device_devicename" name="device[devicename]" size="10" type="text" />
</th>
<th>
<div class='submitbox' id='submitbox_new_device'>S</div>
<script>
$('#submitbox_new_device').click(function (event) {
$('#new_device').submit();
});
</script>
</th>
</form></tr>
</table>
<div class="dropdown-button" style="margin: 0 2px;">Filter</div>
此外,它可以是事件冒泡问题。阅读更多关于事件顺序的信息http://www.quirksmode.org/js/events_order.html – antyrat 2012-04-04 17:04:02
所以你试图选择每个未被选中的tr?看看[选择]选择器的[jQuery文档](http://api.jquery.com/selected-selector/)。你的语法看起来有点偏离。但是,一些DOM示例会帮助您更好地帮助您。 – Primus202 2012-04-04 17:04:42