[RESOLVED]How do I remove an item form a listbox using its index with jquery

How do I remove an item from an asp.net ListBox using its index and JQuery?

After u have the jquery plugin

please refer this url 


I didn’t see where it showed how to remove an item using its index.  can you point me to it?

Try this 

#("listId").eq(1).remove();  // pass index in .eq

Check the sample application I’ve created for you

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ForumsTest.WebForm1" %>

<!DOCTYPE html>
    <script type="text/javascript"
        src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8">
    <script type="text/javascript">
        $(function () {
            $("option:eq(2)").remove(); //this will remove the third option
    <form runat="server">
        <asp:ListBox ID="ListBox1" runat="server">

I’m using jQuery :eq() selector.


Leave a Reply