This is a migrated thread and some comments may be shown as answers.

[Solved] Remove DropList Item via Jquery

3 Answers 150 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
HoC
Top achievements
Rank 1
HoC asked on 06 Oct 2011, 04:37 PM
I am trying to remove an item from my dropList with Jquery.  It seems that the conventional approach does not work...

$("#Type option[value='02']").remove();

Is there any way to remove an item from your dropList control?

Thank you

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Oct 2011, 12:21 PM
Hello Priester,

 
The ComboBox UI component renders LI element for the items instead of OPTION, because the SELECT element. In order to achieve your goal you will need to remove the item from the data array and rebind the combo:

var combobox = $("#ComboBox").data("tComboBox");
combobox.data = combobox.data.slice(1);
combobox.reload();

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
HoC
Top achievements
Rank 1
answered on 13 Oct 2011, 05:36 PM
Thank you!
0
Mahesh
Top achievements
Rank 1
answered on 12 Sep 2012, 04:39 AM
Hi Priester,

Using the above logic, How can we remove a specific option(for ex. Remove the option whose id is "100")???

Regards,
Mahesh
Tags
ComboBox
Asked by
HoC
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
HoC
Top achievements
Rank 1
Mahesh
Top achievements
Rank 1
Share this question
or