Page 1 of 1

Remove selected option from select menu

Posted: Tue May 28, 2013 6:07 pm
by Shahrukh Badar

I have select menu with options

Veg
Fruits
Meal

i want to remove 'Veg' option from select menu.
my select menu is filled by service.


Remove selected option from select menu

Posted: Tue May 28, 2013 6:30 pm
by Maryna Brodina

Hello! If Veg it's a label of the option you can use the following JS:
codeAppery("mobileselectmenuName").find("option").each(function(){
var $this = $(this);
if ($this.text().trim()=="Veg") {
$this.remove();
}
});
Appery("mobileselectmenuName").selectmenu('refresh');/code

If Veg it's a value of the option then use this JS:
codeAppery("mobileselectmenuName").find("option[value=Veg]").remove();
Appery("mobileselectmenuName").selectmenu('refresh');/code

where mobileselectmenuName - Select name