Is it possible to select all elements with a certain class, but not if they contain certain .text()?
Here is what I have so far –
<div class="test">0</div>
<div class="test">1</div>
<div class="test">2</div>
<div class="test">3</div>
<div class="test">4</div>
var divList = $(".test").toArray();
var divLength = divList.length;
What I want to do with this code is to not include the <div> with the 0 in it.
http://api.jquery.com/contains-selector/
Incidentally, to answer epascarello’s question, this will match ANY substring ANYWHERE inside the element. If your numbers go up to 10, it will match and discount that one as well. You’ll need a custom selector or a
.filter()function if that’s an issue for you.