1
我有這樣的搜索形式:搜索表單不提交
,並沒有的提交。當我點擊進入或搜索圖標。爲什麼?
<form action="/search.php" method="get">
<fieldset>
<ul class="toolbar clearfix">
<li><button type="submit" id="btn-search"><span class="fa fa-search" style="color:gray;"></span></button></li>
<li><input type="search" id="search" placeholder="" name="s"></li>
</ul>
</fieldset>
</form>
$(document).ready(function() {
$('#btn-search').on('click', function(e) {
e.preventDefault();
$('#search').fadeIn().focus();
});
});
因爲你告訴它不是做'e.preventDefault()做;' – cbergmiller