How to remove elements from dropdown using jQuery

Previously I had posted about "Get ASP.NET Dropdown selected value and text using jQuery". In this post, I will show you how to remove any specific element from the dropdown list using jQuery. You can remove a particular element from the dropdown list using jQuery.

<select id="ddlList">
  <option value="1">ASP.NET</option>
  <option value="2">C#</option>
  <option value="3">VB.NET</option>
  <option value="4">HTML</option>
  <option value="5">jQuery</option>
</select>

Using jQuery, you can remove element based on the value of the element.

$("#ddlList option[value='2']").remove();

Above code, remove the element with value 2 from the dropdown list. In this example, C# will be removed.

See live Demo and Code.

Feel free to contact me for any help related to jQuery. I will gladly help you.



Responsive Menu
Add more content here...