jquery 处理密码输入框(input type="password" ) 模仿placeholder
html
<form method="post" action="">
<ul>
<li>
<span>邮箱</span>
<input type="text" name="email" value="请输入邮箱" onfocus="if(value == '请输入邮箱'){value =''}" onblur="if(value == ''){value ='请输入邮箱'}" >
</li>
<li>
<span>密码</span>
<input name="" type="text" value="密码" id="text" >
<input name="" type="password" style="display:none;" id="password">
</li>
<li>
<span>验证码</span>
<input type="text" name="code" class="code">
<img src="">
</li>
<li>
<span></span>
<label><input type="checkbox" checked="checked" name="check" class="checked"><i>记住密码</i></label>
<a href="" class="forget">忘记密码</a>
</li>
<li>
<span></span>
<a href="" class="login-btn">登录</a>
</li>
</ul>
</form>
jquery
<script type="text/javascript">
function _password(hid,pid){
var _hid = $("#"+hid);
var _pid = $("#"+pid);
_hid.focus(function(){
var _hval = $.trim($(this).val());
if(_hval != "密码") return;
$(this).css("display","none");
_pid.css("display","block").val("").focus();
});
_pid.blur(function(){
var _hval = $.trim($(this).val());
if(_hval != "") return;
$(this).css("display","none");
_hid.css("display","block").val("密码");
})
}
_password('text','password')
</script>
jquery 处理密码输入框(input type="password" ) 模仿placeholder的更多相关文章
- [转载]Js小技巧||给input type=“password”的输入框赋默认值
http://www.cnblogs.com/Raywang80s/archive/2012/12/06/2804459.html [转载]Js小技巧||给input type="passw ...
- BUG笔记:Win8 IE10下input[type="password"]内字符显示被截取问题
这个BUG发生的截图: 这是发生在Windows8 IE10下,type为password的input文本框内输入长串字符后,初次失去焦点的时候会发生的一个BUG. 发生BUG的原因是这个文本框上应用 ...
- input type=password 浏览器会自动填充密码的问题
解决办法是在form上或input上添加autoComplete="off"这个属性. form表单的属性如下所示: 但是这个解决方案在谷歌和火狐上均有bug,下面来一个一个解决. ...
- input type="datetime-local" 时placeholder不显示
一个坑,input的type="datetime-local" 时,电脑上会显示提示,如图 <input type="datetime-local" na ...
- chrome下input[type=text]的placeholder不垂直居中的问题解决
http://blog.csdn.net/do_it__/article/details/6789699 <input type="text" placeholder=&qu ...
- 手机端input[type=date]的placeholder不起作用
<div class="input clearfix"> <label class="fl">起始日期</label> &l ...
- 利用jquery来隐藏input type="file"
<li> <input type="text" name="token" value = "<?php ech$_SESSIO ...
- jquery对所有<input type="text"的控件赋值
function resetData() { $("input[type=text]").each( function() { $(this).attr ...
- input type="tel" 数字输入框显示圆点
最近开发中遇到一个这样的需求,要求input输入框在手机端出现数字键盘的同时显示圆点,试过各种方法都不太理想, 最终经过查阅大量资料后,终于实现了需求. ●我们一般的密码输入框是这样的: <in ...
随机推荐
- Markdown 学习笔记: Basics
Markdown 学习笔记: Basics 原文:Basics. 了解Markdown格式化句法的要点 本页对如何使用Markdown提供了一个简单的概述.在"句法"页中对Mark ...
- linux环境下jdk 安装以及maven私服搭建
1:准备资源 linux服务器,jdk和nexus 安装包 2:网络通畅,保持windows端和linux服务器端网络通畅. 3: 安装jdk和配置环境变量 进入到 ...
- WCF Service端Inspector
问题 在使用WCF的过程中,有时候需要在service端截取client和service之间的消息来做一些如写log,检查message是否合法的操作. 那么如何才能实现呢? 解决方案 使用WCF提供 ...
- 阐述Lambada表达式
在C#2.0引入匿名方法之前,声明委托的唯一方法就是使用命名方法,C#2.0之后的C#3.0中开始引入了Lambda表达式取代了匿名方法. 匿名方法 要说Lambda必然离不开匿名方法,实际上,Lam ...
- asp.net mvc4 远程验证
[HttpGet] public ActionResult CheckToolsIdExists(string ToolsID) { using (BaseContext context = new ...
- Jasper_crosstab_columngroup header position config - (headerPosition="Stretch")
Position of Totals RowThe totalPosition attribute controls the appearance of the row that displays t ...
- [Google Code Jam (Round 1A 2008) ] A. Minimum Scalar Product
Problem A. Minimum Scalar Product This contest is open for practice. You can try every problem as ...
- 安装Oracle10g on RedHat as 4 64bit(摘)
一.安装前的配置 1.修改RH版本 vi /etc/redhat-release Red Hat Enterprise Linux AS release 3 (Taroon Update 3) 2. ...
- JS 浮点计算BUG
最近做项目的时候遇到一个比较纠结的js浮点计算问题. 当时是做利率计算,因为利率大多数涉及到小数点,精度要求也很高. 0.6+0.1+0.1=? 结果出现:0.7999999999999 网上查找了一 ...
- C语言开发CGI程序的简单例子
这年头用C语言开发cgi的已经不多,大多数的web程序都使用java.php.python等这些语言了. 但是本文将做一些简单的cgi实例. 首先配置环境 #这里是使用的apache AddHandl ...