- Don’t forget the
return
: it’sonsubmit="return someFunction()"
notonsubmit="someFunction()"
- If you are relying on an external javascript file to provide
someFunction()
, the function mustn’t be wrapped in anything else. This means, no$(document).ready()
or the like. As a result, the external script needs to go just before the closing</body>
tag rather than in the<head>
in order for everything to load in the right order.