Reputation: 1024
I have the following situation:
<div id="foo">
<div id="1" style="transform:translate3d(5px,5px,5px);"></div>
<div id="2" style="background-color:black;"></div>
</div>
I want to find the div that does not have the 'transform' property i.e div with 'id = 2'.
I have tried the following, but it only selects the div having transform property, I want the exact opposite.
$('#foo').find('div[style*="transform"]');
Upvotes: 3
Views: 553
Reputation: 11342
console.log($('#foo').find('div:not([style*="transform"])').text());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="foo">
<div id="1" style="transform:translate3d(5px,5px,5px);">111</div>
<div id="2" style="background-color:black;">222</div>
</div>
Upvotes: 2
Reputation: 15555
$('#foo').find('div:not([style*="transform"])').css('color','red')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="foo">
<div id="1" style="transform:translate3d(5px,5px,5px);">1</div>
<div id="2" style="background-color:black;">2</div>
</div>
:not()
Upvotes: 7