ie9的placeholder不显示的解决办法(包含多个密码框)
来源:互联网 发布:怎么用java写服务器 编辑:程序博客网 时间:2024/06/05 08:12
// 兼容ie9的placeholder
function isPlaceholder(){
var input = document.createElement('input');
return 'placeholder' in input;
}
if (!isPlaceholder()) {//不支持placeholder 用jquery来完成
$(document).ready(function() {
if(!isPlaceholder()){
$("input").not("input[type='password']").each(//把input绑定事件 排除password框
function(){
if($(this).val()=="" && $(this).attr("placeholder")!=""){
$(this).val($(this).attr("placeholder"));
$(this).focus(function(){
if($(this).val()==$(this).attr("placeholder")) $(this).val("");
});
$(this).blur(function(){
if($(this).val()=="") $(this).val($(this).attr("placeholder"));
});
}
});
//对password框的特殊处理1.创建一个text框 2获取焦点和失去焦点的时候切换
$("input[type='password']").each(
function() {
var pwdField = $(this);
var pwdVal = pwdField.attr('placeholder');
pwdField.after('<input class="login-input" type="text" value='+pwdVal+' autocomplete="off" />');
var pwdPlaceholder = $(this).siblings('.login-input');
pwdPlaceholder.show();
pwdField.hide();
pwdPlaceholder.focus(function(){
pwdPlaceholder.hide();
pwdField.show();
pwdField.focus();
});
pwdField.blur(function(){
if(pwdField.val() == '') {
pwdPlaceholder.show();
pwdField.hide();
}
});
})
}
});
}
// end
0 0
- ie9的placeholder不显示的解决办法(包含多个密码框)
- 在ie9以下的版本placeholder显示
- ie9不显示flash的解决方法
- Ie9以下的input输入框placeholder属性兼容方案
- win2003 IIS6下IE9不加载 CSS样式文件的解决办法(转载)
- dhtmlx tree在IE9下不显示的问题
- swfupload在IE9中不显示上传按钮的问题
- SWFUpload 在IE9下不显示问题及IE9中模态窗下flash文件选择问题的处理
- SWFUpload 在IE9下不显示问题及IE9中模态窗下flash文件选择问题的处理
- 一行代码解决placeholder 不显示的问题
- echarts切换tab时,第一个图表显示,第二个图表不显示的解决办法
- UIMenuController不显示的解决办法
- html5下input的placeholder标签兼容ie9
- 关于IE9的placeholder属性异常万能解决方案
- 简单实现IE9及以下对placeholder的兼容性
- SVN客户端TortoiseSVN一次Add一个包含的多个文件夹和多个文件的文件夹添加不上的解决办法
- placeholder在IE8中不显示,一种解决办法
- input输入框不为text时placeholder的文本在手机上不显示的解决方案
- Python pip安装
- PHP中this,self,parent的区别及使用方法
- Nginx + PHP (Windows安装)
- 睡眠情况
- linux通过grep kill掉tomcat进程脚本,百分百kill掉
- ie9的placeholder不显示的解决办法(包含多个密码框)
- Another unnamed CacheManager already exists in the same VM.解决方法
- 学习网站/博客论坛推荐(二)
- JAVA常用方法
- Section=ResponseHeader Detail=标头名称无效
- 改变Dialog的样式
- POJ 3253 Fence Repair(贪心—霍夫曼树or优先队列)
- oracle创建表空间和用户
- 灵活运用 SQL SERVER FOR XML PATH