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.
Test:
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 - 918indo.com - 1 months
Car Filters – GTP Motorsports https://gtp.com.my/replacement-air-filters/car-filters/ - Car Filters – GTP Motorsports>>>
Benniewep - 5 months
Car Tuning – GTP Motorsports https://gtp.com.my/home/auto-tune-services/car-tuning-services/ - Show more>>>
Benniewep - 5 months

Powered by Linode.