How to set value for a hidden question by javascript
I have an "Age" question, with type number like this:
Then I want to convert these number into some groups of age, such as:
- Under 40
- [40-49]
- [50-59]
- [60-69]
- 70 and Over
How to do by javascript?
- First, create a single question "D_AgeGroup" right after "Age" question, with such options:
- Second, create a page question type multiple questions per page:
- And then add "Age", "D_AgeGroup" to that multi page:
- After that, at "Age" question, go to CSS tab to hide "D_AgeGroup"
- Finally, also at "Age" question go to Javascript tab, write script for setting value of "D_AgeGroup" from "Age"
You are done.
Viewer only show question of Age. When inputing value on Age question, the approriate value will also set to D_AgeGroup: