当前第2页 返回上一页
主要使用removeAttr
方法移除disabled属性来取消禁用
1 | $( "#select" ).removeAttr( "disabled" );
|
示例:jquery让select不可用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <!DOCTYPE html>
<html>
<head>
<meta charset= "UTF-8" >
<title>Title</title>
<style>
select{
width:100%;
height:100px;
margin:100px 0;
}
</style>
<script src= "https://code.jquery.com/jquery-3.3.1.min.js" ></script>
</head>
<body>
<div id= "div1" >
<select id= "select1" >
<option value= "1" >我是第一个option</option>
<option value= "2" >我是第二个option</option>
<option value= "3" >我是第三个option</option>
<option value= "4" >我是第四个option</option>
</select>
</div>
<div id= "select2" >
<select>
<option value= "1" >我是第一个option</option>
<option value= "2" >我是第二个option</option>
<option value= "3" >我是第三个option</option>
<option value= "4" >我是第四个option</option>
</select>
</div>
<script>
$( function (){
$( "select" ).each( function () {
$(this).attr( "disabled" , "disabled" );
});
});
</script>
</body>
</html>
|
更多编程相关知识,请访问:编程教学!!
以上就是jquery如何让select不可用的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
vue.js的ul-li标签仿select标签
jQuery中hasclass()的意思及用法详解
jQuery怎么设置属性和样式
jQuery怎么让select不可选
html中引用jQuery的两种方法
jQuery如何判断对象是否获得焦点
jQuery怎么操作select
jQuery是否获得焦点
html select标签的用法你知道吗?html select标签属性介绍
vs如何安装jQuery
更多相关阅读请进入《jQuery》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » jquery如何让select不可用