jquery中:input和input的区别
2012-06-21 10:49
218 查看
:input表示选择表单中的input,select,textarea,button元素,input仅仅选择input元素。
<script type="text/javascript">
$(function(){
$(":input").focus(function(){
$(this).addClass("focus");
}).blur(function(){
$(this).removeClass("focus");
});
})//这个效果第三个textarea也会添加样式
</script>
<form action="" method="post" id="regForm">
<fieldset>
<legend>个人基本信息</legend>
<div>
<label for="username">名称:</label>
<input id="username" type="text" />
</div>
<div>
<label for="pass">密码:</label>
<input id="pass" type="password" />
</div>
<div>
<label for="msg">详细信息:</label>
<textarea id="msg" rows="2" cols="20"></textarea>
</div>
</fieldset>
</form>
<script type="text/javascript">
$(function(){
$(":input").focus(function(){
$(this).addClass("focus");
}).blur(function(){
$(this).removeClass("focus");
});
})//这个效果第三个textarea也会添加样式
</script>
<form action="" method="post" id="regForm">
<fieldset>
<legend>个人基本信息</legend>
<div>
<label for="username">名称:</label>
<input id="username" type="text" />
</div>
<div>
<label for="pass">密码:</label>
<input id="pass" type="password" />
</div>
<div>
<label for="msg">详细信息:</label>
<textarea id="msg" rows="2" cols="20"></textarea>
</div>
</fieldset>
</form>
相关文章推荐
- 从重置input file标签中看jQuery的 .val() 和 .attr(“value”) 区别
- jQuery选择器——$(“form1 :input”)与$(“form1 input”)的区别
- 通过jquery获取input的value问题--理解JQuery对象和JS:DOM对象区别与联系
- jquery中:input和input的区别分析
- jquery中$(":input")和$("input")有什么区别
- jquery中:input和input的区别
- Jquery获取元素#form1:input和#form1 :input 的区别
- jquery中$(#form :input)与$(#form input)的区别
- Jquery选择器input:hidden和input[type=hidden]的区别
- jquery 中$("form :input") $("form input") 区别
- Jquery选择器 input 和 :input的区别
- jquery中:input和input的区别分析
- jquery中:input和input的区别
- jQuery中attr()方法和prop()方法获取input的checked属性的区别
- jquery中$(#form :input)与$(#form input)的区别
- 从重置input file标签中看jQuery的 .val() 和 .attr(“value”) 区别
- 用jquery获取input输入框中的id和值、全局变量 局部变量和成员变量区别、
- 从重置input file标签中看jQuery的 .val() 和 .attr(“value”) 区别
- jquery中选择器input:hidden和input[type=hidden]的区别