How to make enter key work like tab | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make enter key work like tab

for a program if we need enter key behave like tab, means as we press enter key it go to next column for input , how can we do so using java script

23rd Jan 2017, 2:52 AM
Manoj singh jalal
Manoj singh jalal - avatar
3 Answers
+ 5
So are you saying that you want the Tab button to behave like Enter? Jesus who would do that.
23rd Jan 2017, 3:15 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
I assume you're doing data entry and people press enter between fields. Tab indexes (for entry forms) http://webcheatsheet.com/html/controll_tab_order.php Doing things on FocusOut...like FocusNext http://stackoverflow.com/q/7208161 --check out other answers in that thread to fit. Enter by default submits forms. If you customize this (commonly done to run validate()) you have to add 'return false' either in validate() or in the attribute onSubmit="func();return false;" to stop navigation.
27th Jan 2017, 4:39 PM
Kirk Schafer
Kirk Schafer - avatar
0
javascript this code will not let line change when enter is pressed rather make spaces cdocument.onkeypressed(evt){ if(evt.keycode==13){ evt.prevent default (); //now input_element_required is the input where it will do input_element_required.value+=". "; } } here input_element_required is the element where typing will lead to this. preventedfault() not let enter key change , and then spaces are added in input_element_required then
23rd Jan 2017, 3:57 AM
Sandeep Chatterjee