Nivin Rai Nivin Rai - 5 months ago 9
jQuery Question

How do I use :not and find () together in jQuery

Is it possible to have :not and find() together, i tried in many ways but in vain .
I basically need to select iterate through all the children of a particular div without tabindex attribute.

Answer

$('#div1').find(':not([tabindex])').addClass('red')
.red{color:red}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='div1'>

<span>red</span>
<span tabindex='1'>123</span>



</div>

Use $('#div1').find(':not([tabindex])')

Comments