css:
#inputSearch {
border:1pxsolid#BABEBF;
color:#999999;
font-size:14px;
height:17px;
padding:3px6px5px6px;
width:200px;
}
#inputSearch.focus{color:#000000;
border:1pxsolid#00A5FF;
}html:
<input type="text" id="inputSearch" class="" value="请输入商品名称" />
js:
$("#inputSearch").focus(function(){
$(this).addClass("focus");
if($(this).val()==this.defaultValue){
$(this).val("");
}
}).blur(function(){
$(this).removeClass("focus");
if($(this).val()==''){
$(this).val(this.defaultValue);
}
})