您的位置:首页 > 其它

解决ie8不支持placeholder方法

2018-01-29 11:36 141 查看
setTimeout(plho,1000);
function plho(){
//判断浏览器是否支持placeholder属性
  supportPlaceholder='placeholder'in document.createElement('input');
if(!supportPlaceholder){
var text = document.getElementById("searchInput").placeholder
document.getElementById("searchInput").value = text
document.getElementById("searchInput").style.color = "#999"
document.getElementById("searchInput").attachEvent("onfocus",add); 
}  
}
function add(){
document.getElementById("searchInput").value =""
document.getElementById("searchInput").style.color="#000"
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: