function placeholder(pcolor) {
var nodes = document.querySelectorAll('[placeholder]');
if(nodes.length){
console.log(nodes)
for(let i=0;i<nodes.length;i++) {
let self = nodes[i],
placeholder = self.getAttribute('placeholder') || '';
self.value = placeholder;
self.style.color = pcolor;
self.onfocus = function(){
console.log(self)
if(self.value == placeholder){
self.value = '';
self.style.color = "";
}
}
self.onblur = function(){
if(self.value == ''){
self.value = placeholder;
self.style.color = pcolor;
}
}
}
}
}
ie9 placeholder
最新推荐文章于 2019-05-12 11:57:27 发布