jQuery之文本框得失焦点
2016-11-27 14:11
267 查看
html代码部分:
这里有两个input,一个textare框。
:input匹配 所有 input, textarea, select 和 button 元素。
jQuery代码部分:
<body> <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> </body>
这里有两个input,一个textare框。
:input匹配 所有 input, textarea, select 和 button 元素。
jQuery代码部分:
<script type="text/javascript"> $(function(){ $(":input").focus(function(){ $(this).addClass("****"); }).blur(function(){ $(this).removeClass("****"); }); }) </script>
相关文章推荐
- jQuery之文本框得失焦点
- jQuery 文本框得失焦点的简单实例
- jQuery 文本框得失焦点应用
- jQuery之文本框得失焦点
- jQuery 文本框得失焦点的简单实例
- jQuery之文本框得失焦点
- JQuery 中,使文本框获得焦点的方法
- JQuery 中,使文本框获得焦点的方法
- JQuery中使文本框获得焦点的方法实例分析
- 基于jquery实现的移入页面上空文本框时,让它变为焦点,移出清除焦点
- jquery关于页面焦点的定位(文本框获取焦点时改变样式 )
- jquery 文本框获取焦点,下拉框将指定项作为当前选择项
- jQuery表单Input文本框默认说明文字获得焦点后消失效果
- JQuery设置文本框和密码框得到焦点时的样式
- jquery实现之文本框失去和得到焦点效果
- Jquery实现文本框获取焦点清空内容,失去焦点重新获得内容
- 基于jquery实现的移入页面上空文本框时,让它变为焦点,移出清除焦点
- JQuery 中,使文本框获得焦点的方法
- JQuery中文本框获取焦点
- jQuery表单Input文本框默认说明文字获得焦点后消失效果