Brian6028327
Posts: 0
Joined: Tue Jul 09, 2013 1:21 pm

How to set the index of menu select with a value?

I have a menu select that's populated with 5 items. When the page that it's on is loaded, I'd like to start with the menu select on item 3. How do I set it with JS (not with 'set property' in the builder)?
-thanks

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How to set the index of menu select with a value?

Hello Brain!

Can you clear, do you want the third item to be chosen? I'm not sure I understand you correctly.

Brian6028327
Posts: 0
Joined: Tue Jul 09, 2013 1:21 pm

How to set the index of menu select with a value?

Hi, yes the third (or whatever) menu choice should be the one that's automatically selected when the page loads (as if the user had selected it).

It'll actually be a local variable, instead of a hard-coded 3. What I'm doing is having the user make a selection on one page then I want that selection to carry through to another page when it loads.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to set the index of menu select with a value?

Hi Brian,

Run the following:
codeAppery( "selectmenu_name" ).find( "option:eq(2)" ).attr("selected", "selected");
Appery( "selectmenu_name" ).selectmenu( "refresh" );/code

Brian6028327
Posts: 0
Joined: Tue Jul 09, 2013 1:21 pm

How to set the index of menu select with a value?

Thanks! That works perfectly!

Return to “Issues”