Well, you could do this in two ways, one is to actually make it into a
form and the do something when the submit have been activated.

The other way includes what you probably are looking for.
You want to read the key that have been pressed. For this you need to
register the keycode on the key down event on every input field inside
the div.

It should be something like this (although it have not been tested):

$('#myDiv :input').keydown(function(e){
  if (e.keyCode==13) {
    //do something when the enter key have been pressed - Enter key
have the keycode of 13
  }
});

On Jun 26, 7:45 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Thanks for your replies.  I have a follow up question.  Let's say I
> have a bunch of inputs, type="text" within a div with id="myDiv".  How
> do trigger an action if someone presses enter within one of those text
> fields?  This would not be a form submission necessarily.
>
>  - Dave
>
> On Jun 26, 5:25 am, tlob <[EMAIL PROTECTED]> wrote:
>
> > A page is read without css? Hmmm I think that is really really really
> > rare.... Even more rare than a browser without js turned on. Thats
> > only really really rare ;-)
>
> > Or what do you mean?
>
> > instead of moving it away, why not css display:none;? Does this brake
> > the submit?
> > cheers
> > tl
>
> > On Jun 26, 10:22 am, Steen Nielsen <[EMAIL PROTECTED]> wrote:
>
> > > You need to insert a submit button in the form to get it working..
> > > <input type="submit">
>
> > > if you don't want to show the button you can always hide it using CSS.
> > > I usually just positioning it -9000px to the left, that way it won't
> > > show up, but if the page is read without CSS, it will be shown
> > > correctly with a submit button
>
> > > On Jun 26, 6:20 am, "[EMAIL PROTECTED]"
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > Hi,
>
> > > > I have a form, with id="myForm", with a number of text fields (input
> > > > with type="text").  How do I cause a form submission by pressing enter
> > > > in any of those form fields?
>
> > > > Thanks, - Dave- Hide quoted text -
>
> > - Show quoted text -

Reply via email to