<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<meta charset="utf-8">
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#ha").click(function(){
$(this).removeClass("ccc");
$(this).addClass("cc2");
$(this).prop("disabled", true); });
});
</script>
<style>
.ccc{ background: #d00000;}
.cc2{ background: #ed9d10;}
</style>
</head>
<body> <button class="ccc" id="ha">添加和删除属性</button>
<br><br>
<div></div> </body>
</html>

jQuery prop() 方法的更多相关文章

  1. jQuery prop方法替代attr方法

    jquery attr()方法获取标签的 checked 会有问题,所以用了 prop() 方法.

  2. jquery prop()方法 解决全选 不全选 反选 问题 解决执行一次不不能再执行问题

    //1.如果通过prop()函数更改<input>和<button>元素的type属性,在多数浏览器上将会抛出一个错误,因为该属性一般不允许在后期更改.//如果使用prop() ...

  3. jquery中dom元素的attr和prop方法的理解

    一.背景 在编写使用高版本[ jQuery 1.6 开始新增了一个方法 prop()]的jquery插件进行编写js代码的时候,经常不知道dom元素的attr和prop方法到底有什么区别?各自有什么应 ...

  4. jQuery 中 attr() 和 prop() 方法的区别

    前几天,有人给 Multiple Select 插件 提了问题: setSelects doesn't work in Firefox when using jquery 1.9.0 一直都在用 jQ ...

  5. jquery 1.6发布后,增加prop()方法部分取代attr()方法

    以前的jq中,全部使用attr来访问对象的属性,比如取一个图片的alt属性,就可以这样做$('#img').attr('alt');   但是在某些时候,比如访问checkbox的disabled属性 ...

  6. input是否checked与使用jquery的attr或prop方法无关

    最近在项目中有这样一个需求,用户在下单时可以选择优惠券,也可取消选择,并且可以多次选择,取消. 这是一个典型的input标签checked功能,博主使用radio元素实现此需求,但是优惠券只能选中,不 ...

  7. 关于jQuery——attr方法和prop方法获取input的checked属性操作

    经常使用jQuery插件的attr方法获取checked属性值,获取的值的大小为未定义,此时可以用prop方法获取其真实值,下面介绍这两种方法的区别: 1.通过prop方法获取checked属性,获取 ...

  8. html单选按钮用jQuery中prop()方法设置

    模拟单选按钮时用jQuery,prop方法来设置. 赋默认选中值:$("#" + id).find("input:radio[value='" + state ...

  9. jquery attr方法和prop方法获取input的checked属性问题

    jquery attr方法和prop方法获取input的checked属性问题   问题:经常使用jQuery插件的attr方法获取checked属性值,获取的值的大小为未定义,此时可以用prop方法 ...

随机推荐

  1. English trip -- VC(情景课) 7 C How much are the shose? 鞋多少钱

    Grammar focus 语法点: How much is ...? How much are...? How much is the shirt?    $15.99. How much are ...

  2. (Gorails)vuejs系列视频: Webpacker/vue-resource(不再为官方推荐)。

    频:https://gorails.com/episodes/using-vuejs-for-nested-forms-part-1?autoplay=1 在嵌套表格上使用vue.js. 在appli ...

  3. UVA-12558 Egyptian Fractions (HARD version) (IDA* 或 迭代加深搜索)

    题目大意:经典的埃及分数问题. 代码如下: # include<iostream> # include<cstdio> # include<cstring> # i ...

  4. Largest Point (2015沈阳赛区网络赛水题)

    Problem Description Given the sequence A with n integers t1,t2,⋯,tn. Given the integral coefficients ...

  5. Nginx 关于 location 的匹配规则详解

    有些童鞋的误区 1. location 的匹配顺序是“先匹配正则,再匹配普通”. 矫正: location 的匹配顺序其实是“先匹配普通,再匹配正则”.我这么说,大家一定会反驳我,因为按“先匹配普通, ...

  6. WindowsLiveWriter安装步骤

    WindowsLiveWriter 安装WindowsLiveWriter.exe http://www.cnblogs.com/rhxuza1993/

  7. snagit12个人爱好

  8. springboot2.0 web 开发标准目录架构

    ├── clean-run.sh ├── logs/ 日志文件目录 │ ├── sb2-web_test_2018-06-02_0959.0.log │ └── sb2-web_test.log | ...

  9. 常用docker

    随便什么版本的linux 接入daocloud.io 在发现镜像中选择DockerHub 搜索对应的image,然后部署. 手动输入YAML即可 aria: image: cuteribs/aria2 ...

  10. L1-003 个位数统计

    给定一个 k 位整数 N=d​(k−1​)*​10^(​k−1)​​+⋯+d​(1)*​​10^​1​​+d(​0)​​ (0≤d(​i)​​≤9, i=0,⋯,k−1, d​(k−1)​​>0 ...