두 개의 버튼이있는 jquerymobile 페이지가 있습니다. 하나는 두 개의 확인란을 모두 선택하고 하나는 모든 확인란의 선택을 취소합니다. 처음으로 check all
을 클릭했지만 작동하지 않으면 더 이상 작동하지 않습니다.jquery 모바일의 모든 체크 박스를 선택/선택 취소합니다.
<div data-role="page" id="selecttest">
<div data-role="header">
<a href="#sc" data-icon="home">SSC</a>
<h1>...</h1>
</div><!-- /header -->
<div data-role="content">
<fieldset class="ui-grid-a">
<div class="ui-block-a"><button onclick="$('#selecttest input[type=checkbox]').attr('checked','checked').checkboxradio('refresh');" data-theme="b">check all</button></div>
<div class="ui-block-b"><button onclick="$('#selecttest input[type=checkbox]').removeAttr('checked').checkboxradio('refresh');" data-theme="b">uncheck all</button></div>
</fieldset>
<fieldset data-role="controlgroup">
<input type="checkbox" name="checkbox-v-2a" id="checkbox-v-2a">
<label for="checkbox-v-2a">One</label>
<input type="checkbox" name="checkbox-v-2b" id="checkbox-v-2b">
<label for="checkbox-v-2b">Two</label>
<input type="checkbox" name="checkbox-v-2c" id="checkbox-v-2c">
<label for="checkbox-v-2c">Three</label>
</fieldset>
</div>
</div><!-- /page -->
내가 jQuery를 1.9.1 사용하고 jQuerymobile 1.3
이미 How to select or unselect all checkboxes in JQuery Mobile?에서 살펴 보았다하지만 내게 도움이되지 않았습니다와 :
여기 내 코드입니다.
@MattBusche을 이용해야 하는가? – idmean
처음에는 인라인 JavaScript를 사용하지 말 것을 강력히 권합니다. –
우선, 우선 ... – idmean