While creating a popup menu with a search bar in it for my new design, I came across a new problem but later solved it. To make a input field to work on hitting enter, it is necessary to put in a form tag because this is what we call submitting a form.
But when I attached that form with submit() function the form submitted to no where. To tackle this we can have a simple solutions.
From a several uses of return false, this can be used in telling the function not to submit the form. Its easy to make, first create a form like:
HTML
<form class='searchform'>
<input type='search' class='searchbar'>
</form>
jQuery
$('.searchfrom').submit(function(){
// Do some magic here!
return false; // this is what stops form to submit
});
Post A Comment:
0 comments: