我有如下所示的html,并且想要选择除<a>
元素之外的所有元素。最终目标是有两个可点击的区域,每个区域都做不同的事情。但我无法隔离更大的区域与元素。jQuery选择除了一个元素以外的所有元素
<td title="title1" class="class1"> <p class="pclass1">value1</p></td>
<td>
<p class="someClass1" title="someTitle1">someValue1</p>
<p class="someClass2" title="someTitle2">someValue2</p></td>
<p class="someClass3" title="someTitle3">someValue3</p>
</td>
<td><p title="otherTitle1" class="otherClass1">otherValue1</p></td>
<td><p title="otherTitle2" class="otherClass2">otherValue2</p></td>
<td><p title="otherTitle3" class="otherClass3">otherValue3</p></td>
<td><p title="otherTitle4" class="otherClass4">otherValue4</p></td>
<td title="title2" class="class2"><a href="#" class="no-select">don't select me</a></td>
那么是否有可能选择除最后'td'中的'a'之外的所有'td?
我试过的东西'td:not(a)', 'td:not(.no-select)'
没有成功
当用户点击''时,您是否希望发生不同于单击其他元素时发生的不同动作?或者,如果他们点击“”? – jessegavin
就此问题而言。我不希望发生任何事情。我会使用另一个选择器来抓取进行其他操作。 –