mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-13 00:58:12 +00:00
Merge pull request #328 from lbai001/patch-1
String concatenation issue
This commit is contained in:
commit
9622ad3676
@ -112,14 +112,20 @@ jsPsych.plugins['survey-multi-choice'] = (function() {
|
|||||||
display_element.querySelector(question_selector).innerHTML += '<div id="'+option_id_name+'" class="'+_join(plugin_id_name, 'option')+'"></div>';
|
display_element.querySelector(question_selector).innerHTML += '<div id="'+option_id_name+'" class="'+_join(plugin_id_name, 'option')+'"></div>';
|
||||||
|
|
||||||
// add label and question text
|
// add label and question text
|
||||||
var option_label = '<label class="' + plugin_id_name + '-text">' + trial.options[i][j] + '</label>';
|
var form = document.getElementById(option_id_name)
|
||||||
display_element.querySelector(option_id_selector).innerHTML += option_label;
|
var input_id_name = _join(plugin_id_name, 'response', i);
|
||||||
|
var label = document.createElement('label');
|
||||||
|
label.setAttribute('class', plugin_id_name+'-text');
|
||||||
|
label.innerHTML = trial.options[i][j];
|
||||||
|
label.setAttribute('for', input_id_name)
|
||||||
|
|
||||||
// create radio button
|
// create radio button
|
||||||
var input_id_name = _join(plugin_id_name, 'response', i);
|
var input = document.createElement('input');
|
||||||
display_element.querySelector(option_id_selector + " label").innerHTML =
|
input.setAttribute('type', "radio");
|
||||||
'<input type="radio" name="' + input_id_name + '" value="' + trial.options[i][j] + '">' +
|
input.setAttribute('name', input_id_name);
|
||||||
display_element.querySelector(option_id_selector + " label").innerHTML;
|
input.setAttribute('value', trial.options[i][j])
|
||||||
|
label.prepend(input);
|
||||||
|
form.appendChild(label)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trial.required && trial.required[i]) {
|
if (trial.required && trial.required[i]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user