Page 1 of 1

select menu: select option

Posted: Mon May 14, 2012 12:45 pm
by janick.eisert

I want to select an option of the select menu. I've tried

$(".selectMenu").val(2);

This should select the option with value 2, but it doesn't work.

In a normal HTML page, it works. How do I solve this problem?


select menu: select option

Posted: Mon May 14, 2012 1:22 pm
by maxkatz

It should still work, make sure the selector is correct. Use Chrome tools (or Firebug) to see what's the actual id is.

You can also use Tiggr(id) function:
http://help.gotiggr.com/documentation...


select menu: select option

Posted: Mon May 14, 2012 2:16 pm
by janick.eisert

I've tried the Tiggr function, but it still doesn't work. The selector and the value is correct. Can you try if it works (in your application)?

Thanks for your help.


select menu: select option

Posted: Mon May 14, 2012 3:17 pm
by maxkatz

I think when you pass a value it sets the value, it doesn't get it: http://api.jquery.com/val/


select menu: select option

Posted: Mon May 14, 2012 3:27 pm
by janick.eisert

I want to set the value...

< select
< option value=" 1 "A < / option
< option value=" 2 "B < / option
< option value=" 3 "C < / option
< / select

When I have this select menu, A is selected (default). But I want that B is selected.


select menu: select option

Posted: Mon May 14, 2012 3:44 pm
by maxkatz

code
Tiggr('&#46;selectMenu')&#46;val(2);
Tiggr('&#46;selectMenu)&#46;selectmenu('refresh');
/code

http://jquerymobile.com/demos/1.1.0/d...

You can also use jQuery directly to select (without Tiggr(id) function).