0
JS 퀴즈를 만들었으며 배열에서 모든 대답을 선택할 수 있습니다. 대답 선택은 생성 된 <input type="radio" . . . . />
요소에 삽입됩니다. 그러나 선택 사항은 레이블 내부에있는 것이 아니라 입력 요소 내부에만 있습니다.jQuery를 사용하여 레이블이있는 라디오 삽입
// Creates a list of the answer choices as radio inputs
function createRadios(index) {
var radioList = $('<ul>');
var item;
var input = '';
for (var i = 0; i < questions[index].choices.length; i++) {
item = $('<li>');
input = '<input type="radio" name="answer" value=' + i + ' />';
input += questions[index].choices[i];
item.append(input);
radioList.append(item);
}
return radioList;
}
: 입력을 생성하는 코드는 내가 여기이
처럼되고 싶어
것 : 여기에 더 내가 무슨 말 확장의
도움을 주시면 대단히 감사하겠습니다.
: http://stackoverflow.com/questions/16973457/how-to-dynamically-create-a-form-element – jsanchezs