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的更多相关文章

  1. [转载]Js小技巧||给input type=“password”的输入框赋默认值

    http://www.cnblogs.com/Raywang80s/archive/2012/12/06/2804459.html [转载]Js小技巧||给input type="passw ...

  2. BUG笔记:Win8 IE10下input[type="password"]内字符显示被截取问题

    这个BUG发生的截图: 这是发生在Windows8 IE10下,type为password的input文本框内输入长串字符后,初次失去焦点的时候会发生的一个BUG. 发生BUG的原因是这个文本框上应用 ...

  3. input type=password 浏览器会自动填充密码的问题

    解决办法是在form上或input上添加autoComplete="off"这个属性. form表单的属性如下所示: 但是这个解决方案在谷歌和火狐上均有bug,下面来一个一个解决. ...

  4. input type="datetime-local" 时placeholder不显示

    一个坑,input的type="datetime-local" 时,电脑上会显示提示,如图 <input type="datetime-local" na ...

  5. chrome下input[type=text]的placeholder不垂直居中的问题解决

    http://blog.csdn.net/do_it__/article/details/6789699 <input type="text" placeholder=&qu ...

  6. 手机端input[type=date]的placeholder不起作用

    <div class="input clearfix"> <label class="fl">起始日期</label> &l ...

  7. 利用jquery来隐藏input type="file"

    <li> <input type="text" name="token" value = "<?php ech$_SESSIO ...

  8. jquery对所有<input type="text"的控件赋值

    function resetData() {      $("input[type=text]").each(      function() {     $(this).attr ...

  9. input type="tel" 数字输入框显示圆点

    最近开发中遇到一个这样的需求,要求input输入框在手机端出现数字键盘的同时显示圆点,试过各种方法都不太理想, 最终经过查阅大量资料后,终于实现了需求. ●我们一般的密码输入框是这样的: <in ...

随机推荐

  1. MySQL 一些小知识

    1. 关于多表查询 我的理解:由于MySQL多表查询时表之间的连接是笛卡尔积的方式,所以尽量少使用多表查询,如果使用则使用嵌套语句 例:说明: `tb_notice_message` 表数量百万级别以 ...

  2. OC基础 单例

    #undef  AS_SINGLETON   #define AS_SINGLETON( __class ) \       + (__class *)sharedInstance;      #un ...

  3. 原创:2016.4.25-2016.5.1 C# informal essay and tittle_tattle

    1.Some  tips of the Time in C sharp (1) How to define the category of the "Datetime"? date ...

  4. unity——使用角色控制器组件+射线移动

    首先要导入unity标准资源包Character Controllers 这个标准资源包,为了方便,还添加了两外一个资源包Scripts,后者包含了一些基本的脚本个摄像机脚本. 没错,这次我们要使用其 ...

  5. php的一些小笔记--时间函数

    strtotime  返回UNIX时间戳 .这个函数可以用来计算前天,昨天,后天,明天 例如明天:date('Y-m-d H:is',strtotime('+1 day')) day>1是复数 ...

  6. Ubuntu 修改 Apache2 用户组 方法

    检查/etc/apache2/envvars文件,发现其中需要使用/etc/apache2/envvars文件中的以下几个环境变量 export APACHE_RUN_USER=www-data ex ...

  7. 使用Hexo搭建GitPage

    资料: hexo官方文档:https://hexo.io/zh-cn/docs/ jekyll官方文档:http://jekyll.com.cn/docs/home/ 简介: 使用hexo和jekyl ...

  8. #include<iostream>与#include<iostream.h>的区别

                                           转载于祝长洋的BLOG:http://blog.sina.com.cn/s/blog_514b5f600100ayks.h ...

  9. HDU 3516 Tree Construction (四边形不等式)

    题意:给定一些点(xi,yi)(xj,yj)满足:i<j,xi<xj,yi>yj.用下面的连起来,使得所有边的长度最小? 思路:考虑用区间表示,f[i][j]表示将i到j的点连起来的 ...

  10. hmac_sha1 签名

    use URI::Escape qw(uri_unescape); use MIME::Base64; use Digest::HMAC_SHA1; $str=Digest::HMAC_SHA1::h ...