mopar003
asked on
Forcing action on hitting 'return' in textfield
Is there a way to do the following:
When a user enters info into a textfield and hits RETURN/ENTER a script calls.
There will be no form tag, because I do not want it to submit, just call the javascript action.
<input name="info" type="text" id="info" size="40"/ onEnter="JavaScript:alert( "TEST");">
Basically I want it to act like it normally would when being submitted in a form tag, just without the form tag, and calling the alert instead.
When a user enters info into a textfield and hits RETURN/ENTER a script calls.
There will be no form tag, because I do not want it to submit, just call the javascript action.
<input name="info" type="text" id="info" size="40"/ onEnter="JavaScript:alert(
Basically I want it to act like it normally would when being submitted in a form tag, just without the form tag, and calling the alert instead.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect. It was the 'return false' that I was missing. Thanks for the quick response.
Like this:
<form onSubmit="JavaScript:alert
<input name="info" type="text" id="info" size="40" >
</form>