在ie9以下的版本placeholder显示
2017-09-22 16:56
204 查看
js代码:
$(function () {
if ((navigator.appName == "Microsoft Internet Explorer") && (document.documentMode < 10 || document.documentMode == undefined)) {
var $placeholder = $("input[placeholder]");
var textArea = $("textarea[placeholder]");
for (var i = 0; i < $placeholder.length; i++) {
$placeholder.eq(i).val($placeholder.eq(i).attr("placeholder")).css({ "color": "#ccc" })
}
for (var i = 0; i < textArea.length; i++) {
textArea.eq(i).val(textArea.eq(i).attr("placeholder")).css({ "color": "#ccc" })
}
}
$placeholder.focus(function () {
if ($(this).val() == $(this).attr("placeholder")) {
$(this).val("").css({"color": "#333"})
}
})
textArea.focus(function () {
if ($(this).val() == $(this).attr("placeholder")) {
$(this).val("").css({ "color": "#333" })
}
})
});
html代码:
<input type="text" class="PDI_Job" placeholder="请输入期望职位"/>
<textarea rows="4" cols="34" placeholder="aaaaaa" ></textarea>
$(function () {
if ((navigator.appName == "Microsoft Internet Explorer") && (document.documentMode < 10 || document.documentMode == undefined)) {
var $placeholder = $("input[placeholder]");
var textArea = $("textarea[placeholder]");
for (var i = 0; i < $placeholder.length; i++) {
$placeholder.eq(i).val($placeholder.eq(i).attr("placeholder")).css({ "color": "#ccc" })
}
for (var i = 0; i < textArea.length; i++) {
textArea.eq(i).val(textArea.eq(i).attr("placeholder")).css({ "color": "#ccc" })
}
}
$placeholder.focus(function () {
if ($(this).val() == $(this).attr("placeholder")) {
$(this).val("").css({"color": "#333"})
}
})
textArea.focus(function () {
if ($(this).val() == $(this).attr("placeholder")) {
$(this).val("").css({ "color": "#333" })
}
})
});
html代码:
<input type="text" class="PDI_Job" placeholder="请输入期望职位"/>
<textarea rows="4" cols="34" placeholder="aaaaaa" ></textarea>
相关文章推荐
- placeholder 兼容IE9以下版本 包含pasword
- jquery 解决ie9及以下版本不支持placeholder属性
- 仿淘宝搜索框之---ie9以下版本placeholder效果
- 让IE9以下版本支持HTML5
- 解决IE9以下ie版本不能识别新元素的方法 添加一个js -- Shiv Solution
- 使用jQuery解决IE9以下无法支持input的placeholder的问题
- bootstrap兼容IE6、7、8版本(IE9以下版本)
- jeecg下使用zTree,IE9极其以下图标显示不出来,原来是...
- 【水晶报表之图片篇-b】 CR 11以下版本动态显示图片(数据库保存图片路径)
- h5兼容ie9以下版本
- IE9版本以下ajax 跨域问题解决
- IE9 以下版本浏览器兼容HTML5的方法,使用百度静态资源的html5shiv包
- 判断浏览器版本是否是ie9以下浏览器,提示升级
- IE10 以下版本完美支持 placeholder 特性
- IE9 以下版本浏览器兼容HTML5的方法
- [置顶] 让IE9以下的版本兼容HTML5解决方案
- Delphi7及其以下版本的 VCL 只支持 Ansi, 所以... WideString 与 UTF8String (定义与 AnsiString 相同) 并没有办法正确的在 VCL 中显示 Del
- 终极解决方案:Crystal report 11以下版本动态显示图片(数据库保存图片路径)
- iOS9以下版本使用WKWebView加载本地HTML文件不显示,处理时容易忽略的问题
- 解决ie9以下input 无placeholder问题