You should be able to intercept that button press by using the submit()
method of the form object.

$('#myForm').submit(function(){
        // this method should fire whether the button was clicked with the
mouse
        // or the enter button was pressed
        return false;
});

<form id="myForm" action="somepage.cfm">
        <input type="text" name="textField" />
        <input type="submit" value="submit me" />
</form>

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, March 25, 2008 12:16 PM
To: jQuery (English)
Subject: [jQuery] submitting the form by pressing ENTER


Hi,

I have a form

<form id="previewForm" name="previewForm">

with two buttons and a text field.  What I would like is when I press enter
on the text field, a JS function is invoked.  What is the JQuery syntax to
trigger this?

Thanks, - Dave


Reply via email to