本文共 657 字,大约阅读时间需要 2 分钟。
prop(name|properties|key,value|fn)
name 属性名称 properties 作为属性的“名/值对”对象
$("input[type='checkbox']").prop("checked");
$("input[type='checkbox']").prop("checked", true);
根据以上可以这样写全选与反全选
for
<input type="checkbox" name="mid[]" value="{$vo.userid}" class="checkid"/>
for end
<input type="checkbox" name="checkall" id="checkall" οnclick="checkAll(this)" />
$("#checkall").click(function(){ $(".checkid").prop("checked", $(this).prop("checked")); });
function checkAll(eleObj) { $(".checkid").prop("checked", $(eleObj).prop("checked")); }
function checkAll() { var ck = $("#checkall").is(":checked"); $(".checkid").each(function(){ $(this).attr("checked", ck); }) }
转载地址:http://tefgz.baihongyu.com/