jquery表单选择器

原创 2019-06-20 11:26:55 200
摘要:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

<title>jquery表单选择器</title>

</head>

<body>


<script>

$(document).ready(function(){

// 选择全部可用的元素

$(':enabled').css('background','#666');

// 选择全部不可用的元素

$(':disabled').css('background','#333');


//选择被选中的select元素

$(':selected').css('background','#888');


//

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

})

</script>

<input type="text"><hr>

<input type="text"><hr>

<input type="text"><hr>

<input type="text" disabled="disabled"><hr>

<input type="text"><hr>

//老师,这个地方的问题是什么?

<select name="" id="">

<option>1</option>

<option>2</option>

<option selected> 3</option>


</select>

<label for=""><input type="checkbox"  checked >1111</label>

<label for=""><input type="checkbox"  >2222</label>

<label for=""><input type="checkbox"  >3333</label>

</body>

</html>


批改老师:天蓬老师批改时间:2019-06-21 09:28:07
老师总结:<input> 中的name属性不能省略

发布手记

热门词条