At the end of the body, just before the </body> tag, you can use this script.
Keep in mind that this depends on the value of your form identifier, and the name of the search field. In this example, the form has an id of "search" and the search field is called "q"
<input type="text" name="q">
var form = document.getElementById('search');