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.
SHARE

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..