Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When I click on the icon in the search box it submits the search. Works perfectly on Chrome... only tested firefox as other browser but fails (wont do anything) have I done something wrong?

<form class="custom-search-form navbar-search" action="/search" method="GET" >
    <input name="keyword" class="autocomplete span4" placeholder="Search for an Attraction...">
    <a href="javascript:(.submit());" onclick="submit()" class="icon-search"></a>
</form>

The issue is with the a href.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
188 views
Welcome To Ask or Share your Answers For Others

1 Answer

what is it javascript:(.submit()); in href

 <a href="javascript:(.submit());" onclick="submit()" class="icon-search"></a>

it should be

<a href="#" onclick="submit(); return false;" class="icon-search"></a>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...