jquery - select the next item of this in each() function

Viewed 16016

I want to select the next element of this in each() function. check out the code comments

$(function(){
    var selects = $('body').find('span');
    selects.each(function(index,el){
        if(index==0){
            //remove the next span of this, which is span2 
        }

    });
}); 


    <body>
        <div>
            <span>1</span>
        </div>
        <span>2</span>
        <div>
            <span>3</span>
        </div>  
    </body>
1 Answers
Related