awesome Mike, thank you Mike
On Dec 17, 2:50 pm, Michael Geary <m...@mg.to> wrote: > Good tip, thanks, Mike. > > A couple of suggestions... First, you could simplify that if test to: > > if( e.which == 13 || e.keyCode == 13 ) > > That would do exactly the same thing in all cases as the original code. > > But you can simplify it even more. jQuery cleans up the properties of the > event object so you don't have to make the browser-dependent tests for both > 'which' and 'keyCode'. You can just use 'which' in all browsers: > > if( e.which == 13 ) > > -Mike > > On Thu, Dec 17, 2009 at 11:06 AM, Mean Mike <mcgra...@gmail.com> wrote: > > keypress > > > $(document).keypress(function(e) { > > if ((e.which && e.which == 13) || > > (e.keyCode &&e.keyCode == 13)) > > { > > // do something > > } > > }); > > mean mike > > On Dec 17, 2:03 pm, "laredotorn...@zipmail.com" > > <laredotorn...@zipmail.com> wrote: > > > Hi, > > > > I would like to capture the event of pressing enter anywhere on the > > > page, even if the focus of the mouse cursor is not on a text field. > > > What event/element am I looking at? > > > > Thanks, - Dave