jquery搜索文本框提示

<input name="" type="text" class="ser_content" value="搜索好音乐" />
//搜索文本提示
	var $ser_content = $('.ser_content');			
//得到焦点事件
	$ser_content.focus(function() {
                var text = $(this).val();
		if(text ==this.defaultValue){
			$(this).val("");
		}
            });			
//失去焦点时的事件
	$ser_content.blur(function() {
                var text = $(this).val();
		if(text == ""){
		  $(this).val(this.defaultValue)
		}
            });

 

posted on 2013-09-17 15:29  火玉  阅读(330)  评论(0编辑  收藏  举报