我的这个input框聚焦失焦事件怎么用不起呢?

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

<script type="text/javascript" >

$(document).ready(function() {

search_focus();

});

function search_focus() {

$(".search-input").focus(function() {

$(this).css('border-bottom', '1px solid red');

}).blur(function() {

$(this).css('border-bottom', '1px solid #c6ccc');

});

}

</script>

<style>

.search-area {margin: 5px 20px 0; border-bottom: 1px solid #C6CCCC; text-align: left;}

.search-input {width: 270px; height: 40px; outline: none; font-size: 14px; color:#747878; background-color: transparent;}

</style>

</head>

<body>

<div class="search-area"><input type="text" class="search-input"></div>

</body>

</html>


未来99
浏览 2728回答 1
1回答

未来99

好了,解决了,原来把$(this).css('border-bottom', '');这个重新值为空,就可以了。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript