How to select all li minus spans with jQuery -


ok here html:

<ol class = "yeargroup">    <li>blah1<span class="red">***</span></li>    <li>blah2</li>    <li>blah3</li>    <li>blah4</li>    <li>blah5</li> </ol> 

i want target text of lis not containing span class of red. got close using :not , :contains, works actual text.

something this:

$(".yeargroup").find("li:not(.red)").eq(random).text(); 

not quite sure error lies.

use this:

$(".yeargroup").find('li').not('li:has(.red)').eq(random).text(); 

demo


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -