Good day.

How to remove jquery option elements in select?

Thank.

    1 answer 1

    @ Roman Rakzin , which element and under what condition / event? In principle, it all comes down to the correct construction of the selector, the distinguishing feature of a certain element <option>. Here, for example, the item that is selected is deleted ( deleted by its index ):

    $('select').on('change', function(){ var $that = $(this); $('option:eq(' + $that.prop('selectedIndex') + ')', $that).remove(); }); 

    Or, we delete the option by its value ( in the example , "v3"):

     $('option[value=v3]').remove();