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 ...
随机推荐
- VS2015 新Web项目(C#6)出现CS1617异常的解决
VS2015 新Web项目(C#6)出现CS1617错误的解决 VS2015新增了对C#6的支持. 在新的Web项目模板中通过引入nuget包Microsoft.CodeDom.Providers.D ...
- PAT 64.Complete Binary Search Tree
题目链接: http://pat.zju.edu.cn/contests/pat-a-practise/1064 思路分析: 1)先对数组排好序. 2)采用中序遍历的方式,将排好序的元素逐个插入在完全 ...
- ashx中session的使用
在平常的页面上是用是很容易就的到request,response对像,从而对其进行一些操作,但在ashx(一般处理程序)中却是有一点的不同, 在ashx你无法正常的使用session,即 contex ...
- 关于Windows8.1更新后Sql Server服务消失的处理办法
前言 微软在17日发布了windows8.1,兴致勃勃地花了半天的时间更新了,不过不知所云的是,在20日又被卸下Windows Store.此为背景. 影响 更新完毕做开发的时候,发现SqlServe ...
- [转发]Gulp开发教程(翻译)
Building With Gulp =================== 转载出处 原文地址 翻译出处 对网站资源进行优化,并使用不同浏览器测试并不是网站设计过程中最有意思的部分,但是这个过程中的 ...
- URL传值中文乱码
url含有中文 先encodeURI(url)编码 获取之后再解码decodeURI //加密 var param = "itname=" + slRows.ITNAME + &q ...
- LeetCode_Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured ...
- Linux/UNIX环境下Oracle数据库多实例开机启动脚本(转)
操作系统平台:RHEL 5Shell环境:BashOracle:10g2 功能描述:开机时自动切换到oracle用户下,启动oracle的多个实例.并记录数据库的启动情况到自定义的日志文件中. #!/ ...
- 如何允许外网可以连接mysql数据库
1.首先检查mysql所在服务器的防火墙,如果限制了外网对3306端口的连接,那么放开限制Linux服务器中执行 iptables -L 可以查看当前的防火墙规则iptables -F 可以清 ...
- 【转】Kconfig,Makefile 和 .config
原文网址:http://blog.csdn.net/nxh_love/article/details/11846861 最新在做Sensor驱动移植的时候,发现了Android driver 中有Kc ...