我有如下所示的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
就此問題而言。我不希望發生任何事情。我會使用另一個選擇器來抓取進行其他操作。 –