I am trying to select elements that do not match a given attribute id. Based on the following simplified example, why does $("td[groupId != 1]") return elements that do not even have the groupId attribute? Is there another way to select elements that have a groupId where the value is not 1?
<table border="1">
<tr>
<td>Group 1</td>
<td groupId="1">1 - 1</td>
<td groupId="1">1 - 2</td>
<td groupId="1">1 - 3</td>
<td>2</td>
<td groupId="2">2 - 1</td>
<td>3</td>
<td groupId="3">3 - 1</td>
<td>Total</td>
</tr>
<tr>
<td>1</td>
<td groupId="1">1</td>
<td groupId="1">1</td>
<td groupId="1">1</td>
<td>2</td>
<td groupId="2">2</td>
<td>3</td>
<td groupId="3">3</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td groupId="1">1</td>
<td groupId="1">1</td>
<td groupId="1">1</td>
<td>2</td>
<td groupId="2">2</td>
<td>3</td>
<td groupId="3">3</td>
<td>0</td>
</tr>
</table>
Try:
$("td[groupId][groupId!='1']")
This type of selector matches all elements with the attribute groupId, but then only chooses the ones where the value is not 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With