JQuery实现radio、select、checkbox禁用
<script>
$(document).ready(function(){
<!-- radio的禁用 -->
var input = $("#appDIV").find("input:radio");
input.attr("disabled","disabled");
input.each(function(){
if($(this).val()==2){
$(this).attr("checked",true);
}
});
<!-- checkbox的禁用 -->
var checkbox = $("#ce").find("input:checkbox");
checkbox.attr("disabled","disabled");
checkbox.each(function(){
if($(this).val()=="Monthly"){
$(this).attr("checked",true);
}
});
<!-- select的禁用方法一 -->
$("#selectItem option:disabled").css('color', '#CCC');
$('#selectItem').change(function(){
if(this[this.selectedIndex].disabled){
this.selectedIndex = this.s||0;
}else{
this.s = this.selectedIndex||0;
}
});
<!-- select的禁用方法二 -->
$("#selectItem").attr("disabled","disabled");
});
//以上方法都可以实现
$(this).find("select,:radio,:checkbox").attr("disabled", "disabled"); 这样也可以直接实现!
</script>
<body>
<div id="appDIV">
<input type="radio" value="1"/>1
<input type="radio" value="2"/>2
<input type="radio" value="3"/>3
</div>
<div id="sel">
<select id="selectItem">
<option value="1" disabled="disabled">Flowers</option>
<option value="2" disabled="disabled">Gardens</option>
<option value="3" selected>Trees</option>
</select>
</div>
<div id="ce">
<input type="checkbox" name="newsletter" value="Daily" />Dairy
<input type="checkbox" name="newsletter" value="Weekly" />Weekly
<input type="checkbox" name="newsletter" value="Monthly" />Monthly
</div>
</body>
转自:http://blog.csdn.net/hongleidy5000/article/details/6265488
转载于:https://www.cnblogs.com/ourLifes/p/7193626.html
JQuery实现radio、select、checkbox禁用相关推荐
- ajax实现多选 radio true,jQuery操作radio、checkbox、select的方法总结
jQuery操作radio.checkbox.select的方法总结 发布于 2015-05-21 06:55:26 | 253 次阅读 | 评论: 0 | 来源: 网友投递 jQuery javas ...
- jquery实用应用之jquery操作radio、checkbox、select
本文收集一些jquery的实用技巧,非常实用的哦,其中对radio.checkbox.select选中与取值的方法. 获取一组radio被选中项的值 var item = $('input[@name ...
- jQuery操作radio、checkbox、select总结
本文转自:http://tiame.iteye.com/blog/1493261 1.radio:单选框 HTML代码: Html代码 <input type="radio&quo ...
- jQuery操作radio、checkbox、select 集合
1.radio:单选框 HTML代码: <input type="radio" name="radio" id="radio1" va ...
- Jquery常用操作:checkbox、select取值,radio、checkbox、select选中及其相关
常用Jquery操作:checkbox取值.select取值.radio选中.checkbox选中.select选中及其相关: 1.影藏页面元素 使用jquery真的很方便,比如要控制div的显示与隐 ...
- Jquery 获取select,radio 和 checkbox的值
1,jquery获取select的值. $("#select1 option:selected").text(); 2,jquery 获取radio的值. $('#radio_id ...
- JQuery选择器及radio,checkbox,select取值和反选
jQuery 的选择器可谓之强大无比,这里简单地总结一下常用的元素查找方法 $("#myELement") 选择id值等于myElement的元素,id值不能重复在文档中只能 ...
- JQUERY对RADIO,CHECKBOX,SELECT的操作常用方法大全
JQUERY对RADIO,CHECKBOX,SELECT的操作 ******************************************************************** ...
- query的checkbox,radio,select等方法总结
1.checkbox日常jquery操作. 现在我们以下面的html为例进行checkbox的操作. <input id="checkAll" type="chec ...
最新文章
- shell在二级python_在python下运行时在shell脚本之间传递shell变量[duplicate]
- 【文文殿下】快速傅里叶变换(FFT)学习笔记
- python数据库密码如何加密_MySQL怎么设置密码
- VTK:可视化之NormalsDemo
- 准备写个nhibernate的学习笔记
- eclipse修改java类时不自动重启
- python怎么开发gui程序_第一个GUI程序
- 2022年 MathorCup 思路分享
- 2020的迷之骗局:从瑞幸退市到老干妈炒鹅 | 凌云时刻
- UTF-8转换为GBK编码
- ITIL问题管理流程设计
- DO-218AB封装,SM8T系列,SM8S系列加强版,汽车级TVS二极管
- leetCode 108. Convert Sorted Array to Binary Search Tree JAVA
- Python当前时间是一年中第几周
- 淘宝算法总监解读——淘宝搜索算法现状
- sentinel中黑白名单
- pip的安装,更新,卸载模块以及使用方法 python
- 计算机视觉(十六):目标检测概述
- SAP S4 Material Management 库存模块 MARD 数据库表读取技术细节介绍
- 04. JavaMail 查询/读取邮件
热门文章
- linux外接NetApp存储,netapp linux iscsi 实现
- OscillatorNode
- nginx ngx_http_proxy_module(反向代理)
- CUDA TOOlkit Programming Guide 2. Programming Model
- sorted(iterable[, key][, reverse])
- freecplus框架-xml解析
- php扇形分布图,使用php绘制扇形分布图
- Spring Boot学习总结(8)——SpringBoot Common application properties(application.properties)详解
- Tomcat学习总结(8)——Tomcat+Nginx集群解决均衡负载及生产环境热部署
- Oracle学习总结(8)—— 面向程序员的数据库访问性能优化法则