Jquery select all elements after

Hello forums

I have these elements



<select id="a"></select>
<select id="b"></select>
<select id="c"></select>
<select id="d"></select>


if I changed the value of B :


$(document).ready(function(){

  $('#b').change(function(){
    //target   c,d and set attr to disabled
    
   });

})

how do I target all the elements after b?
Any ideas?

There are several different ways.

You could use the Next Adjacent Selector (“prev + next”), or you could use the [url=“http://api.jquery.com/next/”]$.next() method, or you could use the [url=“http://api.jquery.com/siblings/”]$.siblings() method, depending on which way you feel like coding.

Thanks pmw57 I think the nextAll() function will work.

Agreed, the $.nextAll() method is the most efficient way to go.