I have the following html code like this:
<div class="question">
<input class="cross-reference-question-value-id" id="enr_rds_question_ids" name="enr_rds_surv_rdsap_xref[enr_rds_question_id]" type="hidden" value="30">
</div>
In this html, the value=15 is the value by the user selected in the front-end. Now I want to store the id into the following script.
var survey_question_type = JSON.parse(document.getElementById('enr_rds_question_id').value)[30];
Here, the user selected the value 30. I want to define a variable for the question_id field and store that variable to the script instead of [30].
Is something like in this fiddle what you’re looking for?
http://jsfiddle.net/veq2V/1/