Good day.
How to remove jquery option elements in select?
Thank.
@ 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(); Source: https://ru.stackoverflow.com/questions/408821/
All Articles