select menu: select option
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?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
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?
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...
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.
I think when you pass a value it sets the value, it doesn't get it: http://api.jquery.com/val/
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.
code
Tiggr('.selectMenu').val(2);
Tiggr('.selectMenu).selectmenu('refresh');
/code
http://jquerymobile.com/demos/1.1.0/d...
You can also use jQuery directly to select (without Tiggr(id) function).