jquery选择器(原创)<三>

现在来看看表单域选择器

1.:input选择器
:input选择器,用于选择所有Input,textarea,select和button元素,语法格式如下:
$(":input")
2.:text选择器
:text选择器用于选择所有的单行文本框(<input type="text"/>),语法格式如下。
$(":text")
3.:password选择器
:password选择器用于选择所有密码框(<input type="password"/>),语法格式如下:
$(":password")
4.:radio选择器
:radio选择器,用于选择所有单选按钮(<input type="radio"/>),语法格式如下:
$(":radio")
5.:checkbox选择器
:checkbox选择器,用于选择所有复选框(<input type="checkbox"/>),语法格式如下。
$(":checkbox")
6.:file选择器
:file选择器,用于选择所有文件域(<input type="file"/>),语法格式如下:
$(":file")
7.:image选择器
:image选择器,用于选择所有图像域(<input type="image"/>),语法格式如下。
$(":image")
8.:hidden选择器
:hidden选择器,用于选择所有不可见的元素(CSS display属性值为none)以及隐藏域(<input type="hidden"/>),语法格式,如下:
$(":hidden")
9.:button选择器
:button选择器,用于选择所有按钮(<input type="button"/>)和<button></button>,,语法格式如下:
$("button")
10.:submit选择器
:submit选择器,用于选择所有提交按钮(<input type="submit"/>)和<button></button>
$(":submit")
11.:reset选择器
:reset选择器,用于选择所有重置按钮(<input type="reset"/>),语法格式如下:
$(":reset")
注意:<button></button>元素,属于同时用$(":button")和$(":submit")返回的元素数组。
<!DOCTYPE html>
<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="js/jquery-1.11.0.js"></script>
<script type="text/javascript"> //文本框被点击的时候,设置其背景色为黄色
$(function () { $(":text").click(function () {
$(this).css("background-color", "yellow"); }); }); //鼠标移到密码框上面的时候,显示:“你输入的密码是加密的!”
$(document).ready(function () {
$(":password").mouseover(function () {
alert("你输入的密码是加密的!")
}); }); //点击男的时候,选择女,点击女的时候,选择男
$(document).ready(function () { $(":radio").eq().click(function () { $(":radio").eq().attr("checked", "true");
}); $(":radio").eq().click(function () { $(":radio").eq().attr("checked", "true");
}); }); //点击复选框的时候,弹出我是复选框
$(function () { $(":checkbox").click(function () { alert("我是复选框"); }); }); //点击文件域的时候,显示,我是文件域
$(function () { $(":file").click(function () { alert("我是文件域");
}); }); </script>
</head>
<body>
<table width="" height="" border="">
<tr>
<td width="" height="">文本框</td>
<td width=""><input type="text"/></td>
<td width="">密码框</td>
<td width=""><input type="password"/></td>
</tr>
<tr>
<td height="">单选按钮</td>
<td><input type="radio" name="groupName"/>男<input type="radio" name="groupName" />女</td>
<td>复选框</td>
<td><input type="checkbox"/><input type="checkbox"/></td>
</tr>
<tr>
<td width="">图像</td>
<td><input type="image"/></td>
<td>文件域</td>
<td><input type="file"/></td>
</tr>
<tr>
<td width="">隐藏域</td>
<td><input type="hidden"/>(不可见)</td>
<td>下拉列表</td>
<td>
<select>
<option>选项一</option>
<option>选项二</option>
<option>选项三</option>
</select>
</td>
</tr>
<tr>
<td height="">提交按钮</td>
<td><input type="submit"/></td>
<td>重置按钮</td>
<td><input type="reset"/></td>
</tr>
<tr>
<td valign="top">文本区域</td>
<td colspan=""><textarea cols="" rows=""></textarea></td>
</tr>
</table>
</body>
</html>
今天就到这里了。。
jquery选择器(原创)<三>的更多相关文章
- jquery选择器(原创)<二>
jquery选择器,选择接着学: 前面学习了基本选择器中的CSS选择器,现在学层级选择器: 1.子元素选择器 子元素选择器,用于在给定的父元素下,查找这个父元素下面的所有的子元素,语法格式,如下: $ ...
- jquery选择器(原创)
jquery选择器大方向可以分为这样: 下面我们先来看看基本选择器总的CSS选择器: 1.标签选择器: $("element") 其中,参数element,表示待查找的HTML标记 ...
- *jQuery选择器总结(原创:最全、最系统、实例展示)
jquery选择器包括四部分:一.基本选择器二.层次选择器三.过滤选择器四.表单元素选择器 一.基本选择器1.ID选择器:$('#myDiv');2.类选择器:$('.className');3.元素 ...
- jQuery选择器我犯的错误(原创)
jQuery的选择器十分强大,但是在使用jQuery选择器的时候一定要十分小心,空格.冒号.引号到处都是坑,老手也不能避免,只能勤加练习,熟能生巧,掌握规律,为了练习,凡是到选择器的地方我都自己先敲, ...
- JQuery 选择器
选择器是JQuery的根基,在JQuery中,对事件的处理,遍历DOM和AJAX操作都依赖于选择器.如果能够熟练地使用选择器,不仅能简化代码,而且还可以事半功倍. JQuery选择器的优势 1.简洁的 ...
- jQuery的案例及必知重要的jQuery选择器
Jquery能做什么 访问和操作DOM元素 控制页面样式 对页面事件进行处理 扩展新的jQuery插件 与Ajax技术完美结合 Jquery的优势 体积小,压缩后只有100KB左右 l强大的选择器 出 ...
- 深入学习jQuery选择器系列第一篇——基础选择器和层级选择器
× 目录 [1]id选择器 [2]元素选择器 [3]类选择器[4]通配选择器[5]群组选择器[6]后代选择器[7]兄弟选择器 前面的话 选择器是jQuery的根基,在jQuery中,对事件处理.遍历D ...
- jQuery选择器和选取方法 http://www.cnblogs.com/MaxIE/p/4078869.html
我们已经使用了带有简单Css选择器的jQuery选取函数:$().现在是时候深入了解jQuery选择器语法,以及一些提取和扩充选中元素集的方法了. 一.jQuery选择器 在CSS3选择器标淮草案定义 ...
- 《锋利的jQuery(第2版)》笔记-第2章-jQuery选择器
选择器是jQuery的根基,在jQuery中,对事件处理.遍历DOM和Ajax操作都依赖于选择器.熟练使用选择器,不仅可以简化代码,而且可以达到事半功倍的效果. 2.1 jQuery选择器是什么 1. ...
- 深入学习jQuery选择器系列第八篇——过滤选择器之伪子元素选择器
× 目录 [1]通用形式 [2]反向形式 [3]首尾元素 [4]唯一元素 前面的话 本文是子元素选择器的续篇,主要介绍关于nth-of-type()选择器的内容.该部分内容并非没有出现在<锋利的 ...
随机推荐
- Java 7 jps - JVM Process Status Tool
本文内容 语法 参数 描述 选项 主机标识符 输出格式 示例 参考资料 先发出来,然后慢慢翻译~ 语法 jps [ options ] [ hostid ] 参数 options 命令行参数. hos ...
- Sublime Text 3103 Crack 破解 注册码(亲测有效)
随机复制下面的几四个注册码 粘贴到sublime text 3(Build 3103)注册框 就可以了! 第一个--first licence key : ====================== ...
- MVC使用基架添加控制器出现的错误:无法检索XXX的元数据
环境 vs2012 框架 mvc3 数据库 sqlservercompact4.0 出现的错误如下: “ ---------------------------Microsoft Visual St ...
- WP主题制作常用标签代码
WordPress模板结构 style.css : CSS文件index.php : 主页模板archive.php : Archive/Category模板404.php : Not Found 错 ...
- WCF客户端承载
http://www.cnblogs.com/wengyuli/archive/2010/12/27/1918109.html参考 Hi victory, 你提出的问题很好,这个问题,相信很多人学 ...
- ch2 创建和销毁对象
ch2 创建和销毁对象
- Eclipse中集成Tomcat
问题: 很多时候在Eclipse中启动Tmocat后,不能访问本机的localhost:8080主页,并且其他项目也不能访问. 原因: 打开Tomcat下的webapp后也找补到项目目录,这是因为Ec ...
- [Under the hood]---Matt Pietrek October 1996 MSJ
Matt Pietrek October 1996 MSJ Matt Pietrek is the author of Windows 95 System Programming Secrets (I ...
- C# barcode生成代码
protected void Page_Load(object sender, EventArgs e) { string code = Request.Params["code" ...
- shell来start、stop、restart应用程序模板
这里使用shell中的case语法: case分支语句格式如下: case $变量名 in 模式1) 命令列表 ;; 模式2) 命令列表 ;; *) ;; esac case行尾必须为单词“in”,每 ...