2013-10-23 69 views
-2

是否有使用Ajax j-query的多个复选框的脚本或代码。 ?我需要这种类型的代码非常迫切的..我已经做到了这一点,通过提交按钮,但现在我需要使用Ajax ..我有使用多个检查取消复选框使用ajax搜索多个复选框

function checkUncheckAll(theElement) { 
var theForm = theElement.form, z = 0; 
for(z=0; z<theForm.length;z++){ 
    if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){ 
     theForm[z].checked = theElement.checked; 
    } 
    } 
} 
+1

我在此处看不到任何ajax代码 – underscore

+0

我需要ajax代码或此解决方案的任何脚本 –

+0

不是真正的答案 –

回答

0

试试这个演示 http://jsfiddle.net/devmgs/Udr3W/1/

<input type="checkbox" name="checkall" onclick="checktoggle(this)" /> 

<input type="checkbox" name="check1" /> 
<input type="checkbox" name="check2" /> 
<input type="checkbox" name="check3" /> 
<input type="checkbox" name="check4" /> 
<input type="checkbox" name="check5" /> 

function checktoggle(obj) { 
    // alert($(obj).prop("checked")); 
$("input[type='checkbox']").prop("checked",$(obj).prop("checked")); 
}