Extracting recode values for dropdown mcq using jQuery | XM Community
Skip to main content
Solved

Extracting recode values for dropdown mcq using jQuery

  • May 5, 2023
  • 2 replies
  • 75 views

Forum|alt.badge.img+6
  • Level 2 ●●

I have a simple dropdown for participants to select their year of birth. I want to create a variable under addOnPageSubmit that will give me the recoded value for this question. I can’t use 

var age = this.getChoiceRecodeValue(this.getSelectedChoices()); 

since the js has to be in a different question on the same page. Ideally, I would want something like the below

 

var age= jQuery("#QID209 option:selected"); 

However, I can’t figure out how to get the recode values using this :( 

Any help is appreciated!

 

Best answer by Shashi

Try below JS:

jQuery("#QID209 select").val()

 

2 replies

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • Answer
  • May 5, 2023

Try below JS:

jQuery("#QID209 select").val()

 


Forum|alt.badge.img+6
  • Author
  • Level 2 ●●
  • May 5, 2023

Thank you! This works perfectly!