abstract:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jquery表单选择器</title> <script type="text/javascript" src=&qu
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jquery表单选择器</title> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script> </head> <body> <script type="text/javascript"> $(document).ready(function(){ // $(':enabled')所有激活的input元素(可以使用的input元素) // $(':disabled')所有禁用的input元素(不可以使用的input元素) // $(':selected')所有被选取的元素,针对于select元素 // $(':checked')所有被选中的input元素 // $('input:enabled').css('background','red') // $('input:disabled').css('background','blue') // $(':selected').css('color','blue') $(':checked').parent().css('color','red') }) </script> <form> 输入框1<input type="text" name=""> 输入框2<input type="text" name=""> 输入框3<input type="text" name="" disabled> 输入框4<input type="text" name=""> <select> <option>html</option> <option>css</option> <option selected="">JavaScript</option> <option>php</option> </select> 爱好: <label><input type="checkbox" name="">看书</label> <label><input type="checkbox" name="">游戏</label> <label><input type="checkbox" name="" checked>打球</label> </form> </body> </html>
Correcting teacher:查无此人Correction time:2019-04-19 09:15:39
Teacher's summary:完成的不错,每行jq代码结束要增加;号。继续加油。