jquery的表单选择器

Original 2019-05-15 11:58:47 223
abstract:<!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">

  div{width: 100px;height: 100px; background: #ccc;margin-top: 20px;}


</style>

</head>

<body>


<script type="text/javascript">


 $(document).ready(function(){

      $(':enabled').css('background','pink')

      $(':disabled').css('background','red')

      $(':selected').css('color','blue')

   $(':checked').parent().css('color','red')

 })

</script>

<form>

 输入框1<input type="text" name=""><br>

 输入框2<input type="text" name=""><br>

 输入框3<input type="text" name="" disabled><br>

 输入框4<input type="text" name=""><br>

 <select>

   <option>摩羯座</option>

   <option selected>双鱼座</option>

   <option>射手座</option>

   <option>天蝎座</option>

 </select>

 <br>

 爱好:

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

 <label><input type="checkbox" name="" checked>游泳</label>

 <label><input type="checkbox" name="">游戏</label>

</form>

</body>

</html> 


Correcting teacher:天蓬老师Correction time:2019-05-15 13:20:59
Teacher's summary:表单选择与操作, 不论是在jquery中, 还是在其它脚本 中, 都是一个重点和难点

Release Notes

Popular Entries