jQuery表單元素選擇器代碼實(shí)例
本文實(shí)例為大家分享了jQuery表單元素選擇器的具體代碼,供大家參考,具體內(nèi)容如下
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title></title> <link rel="stylesheet" href="imooc.css" type="text/css"> <style> input{ display: block; margin: 10px; padding:10px; } </style> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <h2>子元素篩選選擇器</h2> <h3>input、text、password、radio、checkbox</h3> <h3>submit、image、reset、button、file</h3> <div class="left first-div"> <form> <input type="text" value="text類(lèi)型"/> <input type="password" value="password"/> <input type="radio"/> <input type="checkbox"/> <input type="submit" /> <input type="image" /> <input type="reset" /> <input type="button" value="Button" /> <input type="file" /> </form> </div> <script type="text/javascript"> //查找所有 input, textarea, select 和 button 元素 //:input 選擇器基本上選擇所有表單控件 $(':input').css("border", "3px groove blue"); </script> <script type="text/javascript"> //匹配所有input元素中類(lèi)型為text的input元素 $('input:text').css("background", "#A2CD5A"); </script> <script type="text/javascript"> //匹配所有input元素中類(lèi)型為password的input元素 $('input:password').css("background", "yellow"); </script> <script type="text/javascript"> //匹配所有input元素中的單選按鈕,并選中 $('input:radio').attr('checked','true'); </script> <script type="text/javascript"> //匹配所有input元素中的復(fù)選按鈕,并選中 $('input:checkbox').attr('checked','true'); </script> <script type="text/javascript"> //匹配所有input元素中的提交的按鈕,修改背景顏色 $('input:submit').css("background", "#C6E2FF"); </script> <script type="text/javascript"> //匹配所有input元素中的圖像類(lèi)型的元素,修改背景顏色 $('input:image').css("background", "#F4A460"); </script> <script type="text/javascript"> //匹配所有input元素中類(lèi)型為按鈕的元素 $('input:button').css("background", "red"); </script> <script type="text/javascript"> //匹配所有input元素中類(lèi)型為file的元素 $('input:file').css("background", "#CD1076"); </script> </body> </html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- 使用jQuery內(nèi)容過(guò)濾選擇器選擇元素實(shí)例講解
- jquery選擇器之內(nèi)容過(guò)濾選擇器詳解
- jQuery的內(nèi)容過(guò)濾選擇器學(xué)習(xí)教程
- jQuery內(nèi)容過(guò)濾選擇器用法示例
- jQuery內(nèi)容過(guò)濾選擇器與子元素過(guò)濾選擇器用法實(shí)例分析
- jQuery表單對(duì)象屬性過(guò)濾選擇器實(shí)例詳解
- jQuery選擇器之表單元素選擇器詳解
- jQuery表單域選擇器用法分析
- jquery表單對(duì)象屬性過(guò)濾選擇器實(shí)例分析
- jQuery表單元素過(guò)濾選擇器用法實(shí)例分析
- jQuery內(nèi)容選擇器與表單選擇器實(shí)例分析
相關(guān)文章
jQuery實(shí)現(xiàn)表單步驟流程導(dǎo)航代碼分享
這篇文章主要介紹了jQuery實(shí)現(xiàn)表單步驟流程導(dǎo)航,代碼實(shí)現(xiàn)效果簡(jiǎn)單精致,推薦給大家,有需要的小伙伴可以參考下。2015-08-08jQuery實(shí)現(xiàn)側(cè)邊導(dǎo)航欄及滑動(dòng)電梯效果(仿淘寶)
這篇文章主要介紹了如何利用JQuery+CSS模擬淘寶實(shí)現(xiàn)側(cè)邊導(dǎo)航欄以及滑動(dòng)電梯效果,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以動(dòng)手試一試2022-03-03使用隱藏的new來(lái)創(chuàng)建對(duì)象
JQ中發(fā)現(xiàn)的,jQuery.Event類(lèi)。估計(jì)作者是為了減少代碼量。定義一個(gè)類(lèi),但不用new關(guān)鍵字去創(chuàng)建該類(lèi)對(duì)象,而使用方法調(diào)用()方式去創(chuàng)建該對(duì)象。2011-03-03讓新消息在網(wǎng)頁(yè)標(biāo)題閃爍提示的jQuery代碼
可能有一些站長(zhǎng)會(huì)注意到這樣的效果,到收到的新消息會(huì)閃爍標(biāo)題提示,那么新消息在網(wǎng)頁(yè)標(biāo)題閃爍顯示的效果如何實(shí)現(xiàn),下面有個(gè)不錯(cuò)的示例,感興趣的朋友可以參考下2013-11-11jquery focus(fn),blur(fn)方法實(shí)例代碼
jquery focus(fn),blur(fn)方法實(shí)例代碼,需要的朋友可以參考下。2011-12-12jQuery Ajax方法調(diào)用 Asp.Net WebService 的詳細(xì)實(shí)例代碼
我在這里將jQuery Ajax 調(diào)用Aspx.Net WebService 的幾個(gè)常用的方法做了一個(gè)整理,提供給正在找這方面內(nèi)容的博友,希望能給學(xué)習(xí)jQuery的朋友一點(diǎn)幫助,可以直接復(fù)制代碼運(yùn)行。2011-04-04