次のような関数の jQuery セレクターを作成しました。
$('html').not('.table-main tr[selected]').mousedown( function( e ) {
しかし、どういうわけかまったくフィルタリングされておらず、その理由がよくわかりません。セレクターに ('.table-main')を残したとしても、テーブルをクリックすると関数がトリガーされます...何が問題なのですか?
ドキュメントは .not() でまったくトリガーされず、「ボディ」は同じ結果になるため、「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>