title: Run JavaScript on form submit in Drupal 7
body: <p>I have a form with a few fields the user should fill out. The form also have two hidden fields for the users current position (lat, long). I have spent quite some time now trying to find a way to fill these fields.</p>
  
  <p>How I want it to work is like this:
  When form is submitted (jQuery OR OnSubmit in form tag) a JavaScript function that asks the device for location should be run. The hidden fields is then filled with the result.</p>
  
  <p>I have working code for doing this but I can't get it to be called by Drupal.</p>
  
  <p>Is there any way to run a JavaScript function upon form submit in Drupal or should I find another way to do it.</p>
  
  <p>Many thanks,</p>