我想获得一个搜索框,当我点击搜索图标显示,目前的问题是,当它出现它也提交搜索。我怎样才能让搜索框出现,但不提交搜索,这只有当在搜索框中输入内容并点击提交时才会显示。目前的搜索输入框与jquery点击,但不提交
https://jsfiddle.net/9twxq1Lq/1/
<form class="search" method="post" action="/search">
<input type="text" name="criteria" placeholder="Search Box">
<button>
<i class="icons icon-search" aria-hidden="true"></i> <span class="sr">Search Box</span>
</button>
</form>
给予返回false,您想在其中限制提交表单 – rahulsm
在您的javascript按钮onclick中添加event.preventDefault();这可以防止按钮执行其默认行为 –