jQuery选择器之表单对象属性过滤选择器Demo
测试代码:
08-表单对象属性过滤选择器.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>08-表单对象属性过滤选择器.html</title>
<!-- 引入jQuery -->
<script src="../js/jquery-1.4.2.js" type="text/javascript"></script>
<script src="./script/assist.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="./css/style.css" />
<script type="text/javascript">
$(document).ready(function(){
//<button id="btn1">对表单内 可用input 赋值操作.</button>
$("#btn1").click(function(){
$("input:enabled").val("李冠男")
});
//<button id="btn2">对表单内 不可用input 赋值操作.</button>
$("#btn2").click(function(){
$("input:disabled").val("小强");
});
//<button id="btn3">获取多选框选中的个数.</button>
$("#btn3").click(function(){
alert( $("input:checked").length)
});
//<button id="btn4">获取下拉框选中的内容.</button>
$("#btn4").click(function(){
/**
* 1:要遍历的元素的角标
*
* 2:遍历出来的对应的dom
*/
$("select>option:selected").each(function(index,docxml){
//dom 不熟悉
//alert(docxml.value);
alert($(docxml).text());
})
});
});
</script>
</head>
<body>
<h3> 表单对象属性过滤选择器.</h3>
<form id="form1" action="#">
<button type="reset">重置所有表单元素</button>
<input type="checkbox" id="isreset" checked="checked"/><label for="isreset">点击下列按钮时先自动重置页面</label>
<br /><br />
<button id="btn1">对表单内 可用input 赋值操作.</button>
<button id="btn2">对表单内 不可用input 赋值操作.</button>
<button id="btn3">获取多选框选中的个数.</button>
<button id="btn4">获取下拉框选中的内容.</button>
<br /><br />
可用元素:<input name="add" value="可用文本框" /> <br/>
不可用元素:<input name="email" disabled="disabled" value="不可用文本框"/><br/>
可用元素: <input name="che" value="可用文本框" /><br/>
不可用元素:<input name="name" disabled="disabled" value="不可用文本框"/><br/>
<br/>
多选框:<br/>
<input type="checkbox" name="newsletter" checked="checked" value="test1" />test1
<input type="checkbox" name="newsletter" value="test2" />test2
<input type="checkbox" name="newsletter" value="test3" />test3
<input type="checkbox" name="newsletter" checked="checked" value="test4" />test4
<input type="checkbox" name="newsletter" value="test5" />test5
<div></div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
下拉列表1:<br/>
<select name="test" multiple="multiple" style="height:100px">
<option>浙江</option>
<option selected="selected" value="湖南">hunan</option>
<option>北京</option>
<option selected="selected" value="天津">tianj</option>
<option>广州</option>
<option>湖北</option>
</select>
<br/><br/>
下拉列表2:<br/>
<select name="test2" >
<option>浙江</option>
<option>湖南</option>
<option selected="selected" value="北京">beijing</option>
<option>天津</option>
<option >广州</option>
<option>湖北</option>
</select>
<br/><br/>
<div></div>
</form>
<!-- Resources from http://down.liehuo.net -->
</body>
</html>
jQuery选择器之表单对象属性过滤选择器Demo的更多相关文章
- jQuery选择器之表单对象属性筛选选择器
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content ...
- jQuery中的表单对象属性过滤选择器(四、八)::enabled、:disabled、:checked、:selected
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...
- jQuery表单对象属性过滤选择器
jQuery表单对象属性过滤选择器 <div id="p1" attr="p1"> <input type="text" ...
- Jquery | 基础 | jQuery表单对象属性过滤选择器
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>使用jQuery表单对象属性 ...
- 009 jquery过滤选择器-----------(表单对象属性过滤选择器 与 表单选择器)
1.表单对象属性选择器 2.程序 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"& ...
- jQuery 基本选择器 层次选择器 过滤选择器 内容过滤选择器 可见过滤选择器 属性过滤选择器 表单对象属性过滤选择器
- jQuery选择器之表单元素选择器
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content ...
- jquery选择器之表单选择\表单对象属性
:input 匹配所有input标签 :text 匹配所有单行文本框 :password 匹配所有密码框 :radio 匹配所有单选扭 :checkbox 匹配所有复选框 :image 匹配所有图像 ...
- jquery 表单对象属性筛选选择器
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content ...
随机推荐
- branch
1.删除分支 git branch -d branch_name error: The branch 'branch_name' is not fully merged. If you are sur ...
- android 自定义控件二之仿QQ长按删除
自定义Dialog 1.先上个效果图:
- VS2010开发环境最佳字体及配色[转]
从地址:http://www.dev-club.net/xiangxixinxi/42010072906150537/201103010518006.html 获取的,整理如下: 环境:VS2010字 ...
- 小知识~让你的DLL类库带上注释
在我们进行开发公用组件时,一般会把DLL给团队的开发人员直接使用,而不会把项目给他们,因为那样对为框架级代码是不安全的,这时引用框架类库有两种方式,一种是直接复制DLL,第一种是使用包管理工具Nuge ...
- jquery单选框 复选框表格高亮 选中
单选框: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/T ...
- 如何自学Java
转自:http://www.360doc.com/content/12/0624/19/5856897_220191533.shtml JAVA自学之路 JAVA自学之路 一:学会选择 为了就业, ...
- vim编码相关配置
主要与三个参数有有关 fileencoding 缩写:fenc 保存文件时所用的编码 set fenc 查看当前文件的编码 set fenc=utf-8 可以将当前文件转换为utf-8编码 filee ...
- poj 3660 Cow Contest(传递闭包 Floyd)
链接:poj 3660 题意:给定n头牛,以及某些牛之间的强弱关系.按强弱排序.求能确定名次的牛的数量 思路:对于某头牛,若比它强和比它弱的牛的数量为 n-1,则他的名次能够确定 #include&l ...
- IPC——信号量
Linux进程间通信——使用信号量 这篇文章将讲述别一种进程间通信的机制——信号量.注意请不要把它与之前所说的信号混淆起来,信号与信号量是不同的两种事物.有关信号的更多内容,可以阅读我的另一篇文章:L ...
- careercup-高等难度 18.1
18.1 编写一个函数,将两个数字相加,不得使用+或其他算术运算符. int add(int a,int b) { ) return a; int sum=a^b; ; return add(sum ...