Javascript Reference
Categories: tips

javascript move to next input when ENTER key is pressed

@May 11, 2009, 5:25 a.m.
<input onkeydown="if(event.keyCode==13)event.keyCode=9" name="txt1" />
<input onkeydown="if(event.keyCode==13)event.keyCode=9" name="txt2" />

keyCode = 13 is ENTER pressed event
keyCode = 9 is TAB key

Unfortunately, this is IE only. For firefox, it raises the error 'setting a property that has only a getter', beacuase of read-only property of keyCode.
I loved this post! I read your blog fairly often and you are
always coming out with some great stuff. I will shares this on my facebook, instagram and some of my loyalty
followers. Great jobs! Keep work it with it.
azteca - - 1 months
Car Filters – GTP Motorsports - Car Filters – GTP Motorsports>>>
Benniewep - 5 months
Car Tuning – GTP Motorsports - Show more>>>
Benniewep - 5 months

Powered by Linode.