标签:lse fun move spl creat bug return == his
function placeholder(el){
function isPlaceHolder(){
var textarea = document.createElement("textarea");
return "placeholder" in textarea;
}
debugger;
var $el = $(el);
//在不支持placeHolder属性的情况下
if(isPlaceHolder() == false && !('placeholder' in document.createElement('textarea'))){
$('textarea[placeholder]').each(function(){
var that = $(this);
text = that.attr('placeholder');
if(that.val()===""){
that.val(text).addClass('placeholder');
}
//获得光标焦点后,输入框的内容清空
that.focus(function(){
if($el.html() == text){
$el.html("");
}
if(that.val() == text){
that.val("").removeClass('placeholder');
}
}).blur(function(){
//光标焦点离开输入框时,给输入框添加提示内容
if(that.val() === ""){
that.val(text).addClass('placeholder');
}
})
})
}
}
</script/>
-->
标签:lse fun move spl creat bug return == his
原文地址:https://www.cnblogs.com/sidekick/p/9874179.html