You should check for e.shift && e.keycode == '13', technically, if you want to use your approach.
Right now your checking to see if your key is "enter" and "not shift". That's not the same as checking to see if shift is depressed when hitting enter. The other thing you have to keep in mind is that it won't capture someone hitting "shift while holding enter", which is pretty uncommon, but it could happen. I believe Keyboard from More handles that case, however. Also, speaking from an input/interface POV, be aware that shift and enter behave differently. Shift will not repeat itself if the user holds it down (most of the time?) - Enter will. On Thu, Mar 3, 2011 at 11:15 AM, Andrea Dessì <[email protected]> wrote: > Hi, > > can I suggest you to use the More.Keyboard class? :) > > try it here: > http://jsfiddle.net/NKjoep/8PwFE/ > > -- > Andrea > > On Thu, Mar 3, 2011 at 16:50, hamburger <[email protected]> wrote: > >> Hello, >> i would like to check my form for shift-enter >> shift-enter should be allowed. On enter the form should submit. >> >> >> $('chatText').addEvent('keydown',function(event){ >> if ((event.key=='enter') && (event.key!=16)) { >> alert("ENTER"); >> } >> }); >> >> This code do not take care of shift and allerts on enter and on shift- >> enter. >> whats wrong. >> thanks for any help in advance >> >> >
