Thursday, 23 May 2013

How to remove elements from dropdown using jquery?

In this element i will show you how to remove specific element from dropdown list using jquery.

for example

1<select id="ddlList">
2  <option value="1">ASP.NET</option>
3  <option value="2">C#</option>
4  <option value="3">VB.NET</option>
5  <option value="4">HTML</option>
6  <option value="5">jQuery</option>
7</select>
using jquery you can remove value based on the value.

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


above code will remove the element of value 2. that means "c#" will removed.

No comments:

Post a Comment