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.

jquery checkbox checked的更多相关文章

  1. jquery checkbox checked 却不显示对勾

    $("input").attr("checked", true); 或 $("input").attr("checked" ...

  2. jquery checkbox反复调用attr('checked', true/false)只有第一次生效 Jquery 中 $('obj').attr('checked',true)失效的几种解决方案

    1.$('obj').prop('checked',true) 2. $(':checkbox').each(function(){ this.checked=true; }) 为什么:attr为失效 ...

  3. jquery checkbox的相关操作——全选、反选、获得所有选中的checkbox

    1.全选 $("#btn1").click(function(){ $("input[name='checkbox']").attr("checked ...

  4. jQuery checkbox 所有 全选、全不选、是否选中等

    下面是网络收集: jquery判断checked的三种方法:.attr('checked):   //看版本1.6+返回:”checked”或”undefined” ;1.5-返回:true或fals ...

  5. jquery checkbox勾选/取消勾选的诡异问题

    <form> 你爱好的运动是?<input type="checkbox" id="CheckedAll" />全选/全不选<br ...

  6. JQuery Checkbox的change事件

    JQuery   Checkbox的change事件  参考 http://blog.csdn.net/hbhgjiangkun/article/details/8126981   $(functio ...

  7. jquery checkbox选中、改变状态、change和click事件

    jquery判断checked的三种方法:.attr('checked); //看版本1.6+返回:”checked”或”undefined” ;1.5-返回:true或false.prop('che ...

  8. jquery checkbox勾选取消勾选的诡异问题

    jquery checkbox勾选/取消勾选的诡异问题jquery checkbox勾选/取消勾选的诡异问题 <form>        你爱好的运动是?<input type=&q ...

  9. jquery checkbox选中状态

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. c++中的&

    变量的前面表示取变量地址赋值给指针, 如:int a = 0; int *pa = &a;类型后面表示引用,引用即变量的替身. int a = 0; int &ref = a;操作re ...

  2. linux系统和依赖包常用下载地址

    http://ftp.gnome.org/pub/gnome/sources/gstreamer/0.10/ http://www.linuxfromscratch.org/blfs/view/svn ...

  3. 移植UE4的Spline与SplineMesh组件到Unity5

    一个月前,想开始看下UE4的源码,刚开始以为有Ogre1.9与Ogre2.1源码的基础 ,应该还容易理解,把源码下起后,发现我还是想的太简单了,UE4的代码量对比Ogre应该多了一个量级,毕竟Ogre ...

  4. Jconsole加载Jtop插件

    Jconsole加载Jtop插件http://automationqa.com/forum.php?mod=viewthread&tid=3719&fromuid=2

  5. 飞思卡尔9S12X系列双核中的协处理器XGATE使用方法

    http://adi.chinaaet.com/analog/blogdetail/24482.html

  6. Etl之HiveSql调优(union all)

    相信在Etl的过程中不可避免的实用union all来拼装数据,那么这就涉及到是否并行处理的问题了. 在hive中是否适用并行map,可以通过参数来设定: set hive.exec.parallel ...

  7. Sharepoint 2013列表视图和字段权限扩展插件(免费下载)!

    记得2014年春节期间,有博客园的网友通过QQ向我咨询Sharepoint 2013列表视图和字段权限扩展,因为之前他看到我博客介绍Sharepoint 2010列表视图和字段的权限控制扩展使用,问有 ...

  8. new/delete和malloc/free的区别

    通俗易懂版本:http://zhidao.baidu.com/question/86185100 1 new/delete和malloc/free最大区别是对对象的理解. 如果你使用 Foo* foo ...

  9. 读书笔记_Effective_C++_条款四十八:了解模板元编程

    作为模板部分的结束节,本条款谈到了模板元编程,元编程本质上就是将运行期的代价转移到编译期,它利用template编译生成C++源码,举下面阶乘例子: template <int N> st ...

  10. Android代码截屏

    本文来源:http://myhpu2008.iteye.com/blog/999779 这种方法应该只能对当前Activity本身进行截屏,因而你只能在你应用程序中参照该代码对其应用程序本身截屏. i ...