jquery checkbox checked

1.question:

when first operate the checkbox with sentence like :

$("input[type=checkbox]").attr("checked",true);

$("input[type=checkbox]").attr("checkec",false);

it will succeed;

but the second time , it will failed.why??

2.Cause:

if the attribute name of the tag is belong to the tag(the html defined), the prop(name,value) method works,

if the attribute name of the tag is custom , then attr(name, value) method works.

3. Solution:

$("input[type=checkbox]").prop("checked",true);

$("input[type=checkbox]").prop("checked",false);

it works.

上一篇:根据wsdl反向生成webservice服务端(3种方法)


下一篇:改造xxl-job的客户端日志文件生成体系