摘要:<!DOCTYPE html><html><head><meta charset="utf-8"> <title>jQuery选择器</title> <script type="text/javascript"src="jquery-3.3.1.min.js"&
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery选择器</title>
<script type="text/javascript"src="jquery-3.3.1.min.js"></script>
<style type="text/css">
.xuanzhe{width: 300px;height: 150px; background: pink;margin: 20px auto;padding:40px 40px;}
</style>
</head>
<body>
<div class="xuanzhe"><div>
<br/>
<script type="text/javascript">
$(document).ready(function(){
$(':selected').css('color','red')
$(':disabled').css('background','black')
$(':checked').parent().css('color','green')
})
</script>
<form>
姓名<input type="text" name=""><br>
性别<select>
<option>男生</option>
<option selected>女生</option>
</select><br/>
年龄<input type="text" name=""><br>
不符<input type="text" name="" disabled><br>
学历<input type="text" name=""><br>
爱好:
<label><input type="checkbox" name="">听音乐</label>
<label><input type="checkbox" name="" checked>编程</label>
<label><input type="checkbox" name="">打游戏</label>
<br/>
<input type="button" value="提交" >
</form>
</body>
</html>
批改老师:天蓬老师批改时间:2019-03-28 09:50:09
老师总结:表单元素的选择, 不仅在原生js中是一个难点, 在jquery也是一个难点, 难就难在对于同一个元素, 有多种选择方式