필드 세트에 2 개의 라디오 버튼이 있습니다. 두 번째 라디오가 선택되면 조건을 적용하려고 시도하지만 작동하지 않습니다. 방화 광 콘솔을 사용하여 ID로 두 요소를 얻으면 두 요소를 검사한다고합니다.라디오 버튼이 선택된 상태가 작동하지 않습니다.
내 코드 :
<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
<input type="radio" name="soci1" id="sisoci1" value="soci1"/>
<label for="sisoci1">Soci/Abonat</label>
<input type="radio" name="soci1" id="nosoci1" value="nosoci1"/>
<label for="nosoci1">Convidat</label>
</fieldset>
내 기능 :
if(document.getElementById("nosoci1").checked=true){
check_soci1="no_soci";
}else{
check_soci1="soci";
}
파이어 버그의 말씀 :
는>>> document.getElementById("sisoci1")
<input id="sisoci1" type="radio" value="soci1" name="soci1" checked="checked">
>>> document.getElementById("nosoci1")
<input id="nosoci1" type="radio" value="nosoci1" name="soci1" checked="checked">
은 누구도 날 도와 드릴까요? 감사.
if(document.getElementById("nosoci1").checked == true) { ... }
하거나 아예 비교를 건너 :
== 비교입니다. = 함께 체크 된 값을 true로 설정하십시오. –