jQuery选择器之表单选择器

原创 2019-03-04 15:30:02 321
摘要:$(document).ready(function(){$(':enabled')所有激活的input元素(可以使用的input元素)$(':disabled')所有禁用的input元素(不可以使用input元素)$(':selected')所有被选定的元素 针对于select元素     selected 

$(document).ready(function(){

$(':enabled')所有激活的input元素(可以使用的input元素)

$(':disabled')所有禁用的input元素(不可以使用input元素)

$(':selected')所有被选定的元素 针对于select元素     selected  是选定的意思    choice是选择 selected已选定

$(':checked') 所有被选择的input元素       


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

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


$(':selected').css('color','red')*/

$(':checked').parent().css('color','#f40') 


})

-------------------------------------html-----------------------------

<from>


<!-- 输入框1:<input type="" name=""><br><br>

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

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

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

<br><br><br><br>

<select>

<option>马云</option>

<option  selected>刘强东</option>

<option  selected>马化腾</option>

<option>宇哥</option>







</select>-->


<br><br><br><br>

我的爱好:

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

<label><input type="checkbox" checked>写字</label>

<label><input type="checkbox">打豆豆</label>


</from>


批改老师:灭绝师太批改时间:2019-03-04 15:41:50
老师总结:可以跳出老师上课代码,自己带案例测试哦!

发布手记

热门词条