【js】checkbox总结(待续...)

本文介绍了如何使用JavaScript和jQuery操作页面上的checkbox元素,包括获取选中状态、读取选定值及统计选中数量等实用技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.checkbox 单选

http://www.cnblogs.com/CESC4/p/7791821.html

2.checked的选中和未选中

http://www.cnblogs.com/CESC4/p/7643963.html

3.获取radio 或者check选定的值。

http://www.cnblogs.com/CESC4/p/7456827.html 不可用了

http://www.jb51.net/article/48361.htm

https://www.cnblogs.com/td960505/p/6123510.html

4.查找选中的checkbox个数

http://www.cnblogs.com/CESC4/p/7395118.html

5.attr()与prop()

http://blog.youkuaiyun.com/u012124564/article/details/47837615

 

 

var locationType=[];
$("#locationCheck input[type='checkbox']:checked").each(function(){
// var sfruit=$(this).val();
// alert(sfruit);
locationType.push($(this).val());
});
console.log(locationType);
console.log('分割线');

$("#locationCheck").find("input[type='checkbox']:checked").each(function () {
// console.log($(this).val());
locationType.push($(this).val());
});
console.log(locationType);

 

转载于:https://www.cnblogs.com/CESC4/p/7791965.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值