博客
关于我
jquery 全选与反全选
阅读量:750 次
发布时间:2019-03-21

本文共 768 字,大约阅读时间需要 2 分钟。

jQuery Prop Method 开关控制操作

Prop方法是 jQuery 中一个强大的属性操作工具,能够同时操作多个元素属性的一种高效解决方案。

基础用法示范

prop("property_name") 接收三个可能值:name - 属性名称

properties - 作为对象的属性{"key": value}
key, value - 指定修改特定的属性名及其值

例:简单的值初始状态

_globChat.checked = prop();

dynamicProp.value = prop("key , value");

状态切换方法

[CDATA[src = "prop(name,properties,key,value,fn)"]]

defaults: prop("property_name")

prop("property_name", defaultValue);

具体应用示例

$("input[type='checkbox']",-div>

全选与反全选操作

基于类名 checkid 的多个 checkbox 元素,实现统一切换

统一选中操作

function checkAll(eleObj) {

$(".checkid").prop("checked", eleObj.prop("checked"));

}

统一取消选中操作

function unCheckAll(eleObj) {

$(".checkid").prop("checked", null);

}

类名为基础的单元素控制

var ck = $("#checkall").prop("checked");

$(".checkid").each(function() {

$(this).prop("checked", ck);

});

转载地址:http://tefgz.baihongyu.com/

你可能感兴趣的文章
Prometheus Grafana 展示平台
查看>>
Prometheus pushgateway使用详解
查看>>
Prometheus 云原生 - Prometheus 数据模型、Metrics 指标类型、Exporter 相关
查看>>
Prometheus 云原生 - 基于 file_sd、http_sd 实现 Service Discovery
查看>>
Prometheus 云原生 - 微服务监控报警系统 (Promethus、Grafana、Node_Exporter)部署、简单使用
查看>>
Prometheus 云原生 - 监控 Linux、MySQL、Redis、RabbitMQ、Docker、SpringBoot 3.x
查看>>
Prometheus 介绍
查看>>
Prometheus 安全配置详解
查看>>
prometheus 安装node_exporter, node_exporter 安装最新版 普罗米修思安装监控服务器client
查看>>
Prometheus 安装部署实战
查看>>
prometheus 持久化存储方案
查看>>
Prometheus 监控系统企业级实战
查看>>
Prometheus 监控系统简介
查看>>
Prometheus 配置详解
查看>>
Prometheus 采集器使用详解
查看>>
Prometheus 黑盒监控实战
查看>>
prometheus+alertmanager+grafana监控部署教程
查看>>
Prometheus+Grafana构建智能化Kubernetes监控系统实战
查看>>
Prometheus+SpringBoot应用监控全过程详解
查看>>
Prometheus+SpringBoot应用监控全过程详解
查看>>