return checkboxes to within label elements

Checkbox elements were previously child elements of their labels.
55106fe increased backwards compatibility, but seems to have
inadvertently made them siblings instead, breaking some css.
Fix that.
This commit is contained in:
Dillon Plunkett 2020-02-25 16:54:28 -05:00
parent 9de501e9da
commit be6c945419
2 changed files with 4 additions and 3 deletions

View File

@ -140,8 +140,9 @@ jsPsych.plugins['survey-multi-choice'] = (function() {
// add radio button container
html += '<div id="'+option_id_name+'" class="jspsych-survey-multi-choice-option">';
html += '<label class="jspsych-survey-multi-choice-text" for="'+input_id+'">'+question.options[j]+'</label>';
html += '<label class="jspsych-survey-multi-choice-text" for="'+input_id+'">';
html += '<input type="radio" name="'+input_name+'" id="'+input_id+'" value="'+question.options[j]+'" '+required_attr+'></input>';
html += question.options[j]+'</label>';
html += '</div>';
}

View File

@ -146,14 +146,14 @@ jsPsych.plugins['survey-multi-select'] = (function() {
label.innerHTML = question.options[j];
label.setAttribute('for', input_id)
// create checkboxes
// create checkboxes
var input = document.createElement('input');
input.setAttribute('type', "checkbox");
input.setAttribute('name', input_name);
input.setAttribute('id', input_id);
input.setAttribute('value', question.options[j])
form.appendChild(label)
form.insertBefore(input, label)
label.insertBefore(input, label.firstChild)
}
}
// add submit button