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

Linux vanilla kernel on QEMU and networking with eth0 -

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

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -