On my FORM
, for some reason, I can get my form input variable via onsubmit
but not using action
.
This 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 doesn't work (this.city.value
is found to be 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 is it that onsubmit
can get the this.city.value
but the action
event cannot?