Blogger Ever

Use jQuery submit() function in form without submitting it

A person fill up the field and hit enter but user is not always submitting the form.

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:


<form class='searchform'>
   <input type='search' class='searchbar'>


// Do some magic here!
return false; // this is what stops form to submit

2013-2016 Copyright Blogger E\ver . Coded, managed and founded by Mohammad Hamza (@hamzadhamiya) . Hosted on Blogger and fonts used are Raleway and Open Sans.