搜索文本框焦点离开时文本位置跳动问题解决方法
摘要:搜索文本框焦点离开时设置文本,位置跳动问题//搜索文本框$("#txtSearch").focus(function(){if($(this...
搜索文本框焦点离开时设置文本,位置跳动问题
//搜索文本框
$("#txtSearch").focus(function () {
if ($(this).val() == "请输入搜索关键字") {
$(this).val("");
$(this).css("color", "black");
}
}).blur(function () {
if ($(this).val() == "") {
$(this).css("color", "gray").val("请输入搜索关键字");
}
});
在css中加入
#txtSearch
{
width:480px;
height:20px;
vertical-align:middle;
}
【搜索文本框焦点离开时文本位置跳动问题解决方法】相关文章:
上一篇:
css 样式加载的优先级使用经验分享
下一篇:
css技巧收藏——经典中的经典