搜索文本框焦点离开时文本位置跳动问题解决方法
搜索文本框焦点离开时文本位置跳动问题解决方法
发布时间:2016-12-27 来源:查字典编辑
摘要:搜索文本框焦点离开时设置文本,位置跳动问题//搜索文本框$("#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;

}

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新心得技巧学习
热门心得技巧学习
网页设计子分类