jquery-mobileselect-menu

jquerymobile to change icon in selectmenu


Hopefully this is really straightforward and simple. I can't select the selectmenu in JQM. please see the jsfiddle at the bottom.

I just want to dynamically change the icon from downarrow to star. I can't seem to even 'select' the selectmenu though using an id. Only badly using a class. I've left in a few of the tonnes of things I've tried, can someone show how to do it properly please.

I was expecting this to work. But I've tried this and lots more with no luck.

$('#foo').selectmenu({ icon: "star" });

JSFiddle

http://api.jquerymobile.com/selectmenu/#option-iconpos


Solution

  • Do you absolutely need to do it dynamically ? Otherwise you could just use the data attributes :

    data-icon="star" data-iconpos="left"