您的位置:首页 > 其它

文本框中有默认的文字,写获取焦点和失去焦点的文字显示与消失的效果

2012-12-18 09:05 579 查看
$(".QuesComment").each(function(){

$(this).val('请输入100字以内的评语').css('color','#666666');

$(this).focus(function(){

$(this).css('color','#000');

if(!this.initValue){
this.initValue = this.value;
}

if(this.value === this.initValue){
this.value = '';
}

}).blur(function(){

if(this.value === '' || this.value === null){
this.value = this.initValue;
$(this).css('color','#666666');

}
});
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐