javascript - How to select first element in each group using jQuery? -


given following html input:

<p>a</p> <p>b</p> <p>c</p> <div>d</div> <p>e</p> <p>f</p> <p>g</p> 

i can use following select b, c, f , g:

$('p + p') 

how can select a , e?

$('???').each(function() {     var restofgroup = $(this).next('p'); }); 

you can use inverse:

$('p:not(p+p)') 

Comments

Popular posts from this blog

rdbms - what exactly the undo information lives in oracle? -

bash - How do you programmatically add a bats test? -

java - Getting exception in JDBC thin driver -