jQuery表單域選擇器用法分析
本文實(shí)例分析了jQuery表單域選擇器用法。分享給大家供大家參考。具體如下:
表單域是指網(wǎng)頁中的input,textarea, select和button元素。
1. :input選擇器
2. :text選擇器
3. :password選擇器
4. :radio選擇器
5. :checkbox選擇器
6. :file選擇器
7. :image選擇器
8. :hidden選擇器
9. :submit選擇器
10. :reset選擇器
簡(jiǎn)單實(shí)例:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表單域選擇器</title>
<script type="text/javascript" src="jquery-1.7.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(":text").attr("value", "文本框");
$(":password").attr("value", "密碼框");
$(":radio:eq(0)").attr("checked", "true");
$(":checkbox").attr("checked", "true");
$(":image").attr("src", "ICO.ICO");
$(":file").css("width", "200px");
$(":hidden").attr("value", "已保存的值");
$("select").css("background", "#FCF"); //注意沒有冒號(hào)
$(":submit").attr("id", "btn1");
$(":reset").attr("name", "btn");
$("textarea").attr("value", "文本域"); //注意沒有冒號(hào)
});
</script>
</head>
<body>
<table width="730" height="145" border="1">
<tr>
<td width="113" height="23">文本框</td>
<td width="209"><input type="text"/></td>
<td width="93">密碼框</td>
<td width="287"><input type="password" /></td>
</tr>
<tr>
<td height="24">單選按鈕</td>
<td><input type="radio" /><input type="radio" /></td>
<td>復(fù)選框</td>
<td><input type="checkbox" /><input type="checkbox" /></td>
</tr>
<tr>
<td height="36">圖像</td>
<td><input type="image" /></td>
<td>文件域</td>
<td><input type="file" /></td>
</tr>
<tr>
<td height="23">隱藏域</td>
<td><input type="hidden" />(不可見)</td>
<td>下拉列表</td>
<td><select><option>選項(xiàng)一</option><option>選項(xiàng)二</option><option>選項(xiàng)三</option></select></td>
</tr>
<tr>
<td height="25">提交按鈕</td>
<td><input type="submit" /></td>
<td>重置按鈕</td>
<td><input type="reset" /></td>
</tr>
<tr>
<td valign="top">文本區(qū)域:</td>
<td colspan="3"><textarea cols="70" rows="3"></textarea></td>
</tr>
</table>
</body>
</html>
效果圖如下所示:

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
- 使用jQuery內(nèi)容過濾選擇器選擇元素實(shí)例講解
- jquery選擇器之內(nèi)容過濾選擇器詳解
- jQuery的內(nèi)容過濾選擇器學(xué)習(xí)教程
- jQuery內(nèi)容過濾選擇器用法示例
- jQuery內(nèi)容過濾選擇器與子元素過濾選擇器用法實(shí)例分析
- jQuery表單對(duì)象屬性過濾選擇器實(shí)例詳解
- jQuery選擇器之表單元素選擇器詳解
- jquery表單對(duì)象屬性過濾選擇器實(shí)例分析
- jQuery表單元素選擇器代碼實(shí)例
- jQuery表單元素過濾選擇器用法實(shí)例分析
- jQuery內(nèi)容選擇器與表單選擇器實(shí)例分析
相關(guān)文章
jQuery實(shí)現(xiàn)返回頂部功能適合不支持js的瀏覽器
a標(biāo)簽指向錨點(diǎn)top,可以在頂部防止一個(gè)a name=top的錨點(diǎn),這樣在瀏覽器不支持js時(shí)也可以實(shí)現(xiàn)返回頂部的效果了2014-08-08
jQuery 遍歷-nextUntil()方法以及prevUntil()方法的使用介紹
本篇文章介紹了,jQuery 遍歷-nextUntil()方法以及prevUntil()方法的使用。需要的朋友參考下2013-04-04
jquery中$.post()方法的簡(jiǎn)單實(shí)例
本篇文章主要是對(duì)jquery中$.post()方法的簡(jiǎn)單實(shí)例進(jìn)行了介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2014-02-02
jQuery實(shí)現(xiàn)每日秒殺商品倒計(jì)時(shí)功能
這篇文章主要介紹了 jQuery實(shí)現(xiàn)每日秒殺商品倒計(jì)時(shí)功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-09-09
jQuery實(shí)現(xiàn)簡(jiǎn)單的點(diǎn)贊效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)簡(jiǎn)單的點(diǎn)贊效果的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-01-01
基于jquery異步傳輸json數(shù)據(jù)格式實(shí)例代碼
這篇文章主要介紹了jquery異步傳輸json數(shù)據(jù)格式實(shí)例代碼,有需要的朋友可以參考一下2013-11-11
jquery中的工具使用方法$.isFunction, $.isArray(), $.isWindow()
這篇文章主要介紹了jquery中的工具使用方法$.isFunction, $.isArray(), $.isWindow(),需要的朋友可以參考下2015-08-08

