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. jQuery插件:模拟select下拉菜单

    没搞那么复杂,工作中,基本够用.. <!doctype html> <html> <head> <meta charset="utf-8" ...

  2. DIV实现纵向滚动条overflow-y

    DIV实现纵向滚动条overflow-y:scroll的使用, 1.首先设置固定div的宽高2.overflow-y:scroll如果设置overflow:auto;表示当你内容超过div高度出现滚动 ...

  3. volley二次封装

    产品中使用Volley框架已有多时,本身已有良好封装的Volley确实给程序开发带来了很多便利与快捷.但随着产品功能的不断增加,服务器接口的不断复杂化,直接使用Volley原生的JSONObjectR ...

  4. 版本控制与vermagic

    http://hychen.wuweig.org/blog/2009/10/09/rao-guo-linux-driver-vermagicjian-cha/ cd scripts grep 'dir ...

  5. 自动化测试管理平台ATMS(V2.0.2_8.19)下载

    自动化测试管理平台ATMS(V2.0.2_8.19)下载 http://www.automationqa.com/forum.php?mod=viewthread&tid=2791

  6. pod install 错误 - incompatible character encodings: UTF-8 and ASCII-8BIT

    pod install [!] Invalid `Podfile` file: incompatible character encodings: UTF-8 and ASCII-8BIT. Upda ...

  7. ubuntu安装php mcrypt扩展

    1.安装扩展 sudo apt-get install php5-mcrypt 2.添加扩展配置文件 apt-get没有在/etc/php5/cli/conf.d/和/etc/php5/fpm/con ...

  8. Apache2.4为什么启动报错Cannot load php5apache2_4.dll into server

    最近学习php,按照书上的描述,下载好apache和php后,按照其中配置进行,结果遇到了上述问题.花费了近一个半小时的时间解决了上述问题.现把解决问题过程中看到的方法总结如下.  最先肯定是一定要注 ...

  9. mingW与cygwin

    转自:http://hi.baidu.com/ooxxer/item/d25dccc072846a50ac00ef7e# 首先MingW和cygwin都可以用来跨平台开发.  MinGW是Minima ...

  10. 【转载】JDBC连接各种数据库的字符串

    oracle    driverClass:oracle.jdbc.driver.OracleDriver    url:jdbc:oracle:thin:@127.0.0.1:1521:dbname ...