嗨,大家好我需要在發出ajax請求後檢查某些複選框。在ajax調用後檢查某些複選框
Ajax請求不從另一個頁面拉複選框和使用jQuery的是原單頁上。林不知道如何去這個我想:
<input type="checkbox" class="case" name="case" value="1"/>
<input type="checkbox" class="case" name="case" value="2"/>
<input type="checkbox" class="case" name="case" value="3"/>
<input type="checkbox" class="case" name="case" value="4"/>
$(document).ready(function()
{
$(function()
{
$("#selectall").on('click', function(){
$('.case').attr('checked',this.checked);
});
$(".case").on('click', function(){
if($(".case").length==$(".case:checked").length)
{
$("#selectall").attr("checked","checked");
}
else
{
$("#selectall").removeAttr("checked");
}
});
});});
時,有沒有涉及Ajax請求,工作正常。我想知道如果有人能夠幫助我找到一種方法來允許在使用ajax請求時檢查複選框嗎?
感謝
感謝,即時得到一個錯誤,現在說對象對我會需要把這個函數在jQuery中的的document.ready沒有方法? – user1714133
是的,它需要去裏面的document.ready jQuery中 –
IM仍然得到錯誤的「對」 – user1714133