jq表单选择器案例

Original 2018-11-05 17:42:36 181
abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jq属性选择器</title> <script src="jquery-3.3.1.min.js"></script&g
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jq属性选择器</title>
<script src="jquery-3.3.1.min.js"></script>

<!-- $('input[属性名]') $('input[属性名=值为]') -->

<script>
$(document).ready(function(){
// $('input[type]').css('background','pink')
// $('input[type=botton]').css('background','blue')
// $(':enabled').css('background','red');
$(':selected').css('background','blue');
$(':checked').parent().css('color','red');

})

</script>
</head>
<body>
<form action="">
输入框1<input type="text" name=""><br>
输入框2<input type="text"><br>
输入框3<input type="text" disabled><br>
输入框4<input type="text"><br>
</form>
<select name="" id="">
<option >下拉选择1</option>
<option >选择器1</optio>
<option >选择器1</optio>
<option selected>经理就</option>

</select>
<label ><input type="checkbox" name="">看书</label>
<label ><input type="checkbox" name="" checked>看书</label>
<label ><input type="checkbox" name="">看书</label>



</body>
</html>

表单选择器 可以根据表单的状态进行选择。语法:$(':状态'),激活状态enabled,禁用disabled,选中:checked。下拉选中:selected。

Correcting teacher:韦小宝Correction time:2018-11-05 17:55:50
Teacher's summary:写的很不错!代码很完整!继续加油吧!骚年!!

Release Notes

Popular Entries