clearing select using jquery

use .empty()

 $('select').empty().append('whatever');

you can also use .html() but note

When .html() is used to set an element’s content, any content that was in that
element is completely replaced by the new content. Consider the following HTML:

alternative: — If you want only option elements to-be-remove, use .remove()

$('select option').remove();

Leave a Comment