2
여러 체크 박스에 대한 토글을 구현하려고하지만 하나를 수동으로 전환하면 토글로 더 이상 체크 박스가 고려되지 않습니다.여러 체크 박스 토글 - 프로토 타입 js
var publishAll = $("toggle");
publishAll.observe('click', function(e){
\t var state = null;
\t if(this.checked) {
\t \t state = "checked";
\t }
\t $$('.checkbox').invoke('writeAttribute', 'checked', state);
});
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
<input id="toggle" type="checkbox" name="toggle" value="true"> Toggle checkbox<br /><br />
check these manually and it won't work with toggle anymore.<br />
<input class="checkbox" type="checkbox" name="checkbox[]" value="1"><br />
<input class="checkbox" type="checkbox" name="checkbox[]" value="2">
내가 뭔가 잘못 했습니까? 대신 "확인"을 확인의 속성을 설정하려고의
나는 당황 스럽다. \ code가 나에게 잘 보이고, 나는 손으로 그들을 토글 할 때 검사관에서 아무것도 변하지 않는다. ... –
나는 또한 당황하고있다. 그리고 나는이 문제를 어떻게 의미 론적으로 풀어 낼지 모릅니다! – rayphi