javascript - html5 form submission issue -


i have piece of javascript initialized on click of button, , takes information form input perform geolocation etc based on data.
issue having have place button outside of form in html, otherwise when clicked, no javascript fired!
of course means users cannot hit enter in offending text box (as lose data!)
there way can stop happening , able include button in form?

the html is:

<form> <input id="addyinput" placeholder="don't forget postcode!" size="25">  </form> <button id="start" onclick="initialize()">find me!</button> 

i can include of javascript if needs be! (although works fine!) :)

thanks!

use :

<button id="start" onclick="return initialize()">find me!</button> 

and make sure initialize() returns false.


Comments