i have a dropdown and i want to clear all items from it using jquery. i see a lot of google links about removing selected item but i want to clear ALL items from a dropdown.
what is the best way of removing all items from a select dropdown list?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
BEST way: use
.empty()DEMO
Note: Use
.remove()when you want to remove the element itself, as well as everything inside it