jQuery :enabled 选择器
实例
选择所有启用的表单元素:
<!DOCTYPE html>
<html>
<head>
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(":enabled").css("background-color","red");
});
</script>
</head>
<body>
<form action="">
名称: <input type="text" name="user"><br>
ID:<input type="text" name="id" disabled="disabled">
年龄:
<select disabled="disabled">
<option>20-30
<option>30-50
<option>50+
</select>
<input type="submit">
</form>
</body>
</html>
定义与用法
:enabled
选择器选择所有启用的表单元素。
语法
$(":enabled")