On my FORM for some reason, I can get the form input variable via onsubmit , but not using action .
It works:
<form onsubmit="javascript:myFunc(this.city.value);"> <p><input type="text" id="city-field" name="city" onfocus="this.select();" /> <input type="submit" value="Find" /></p> </form>
This does not work ( this.city.value is considered null)
<form action="javascript:myFunc(this.city.value);"> <p><input type="text" id="city-field" name="city" onfocus="this.select();" /> <input type="submit" value="Find" /></p> </form>
Why can onsubmit get this.city.value , but the action cannot?
Zoowealander
source share