Click here to Skip to main content
15,908,455 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
How to stop the cursor move before filling the textbox to next.
Posted
Comments
ZurdoDev 13-Jan-16 7:31am    
You need to be more clear and show us where you are stuck. But you probably want to use the keypress event. http://www.w3schools.com/jsref/event_onkeypress.asp

1 solution

If you mean mouse cursor, nothing can prevent moving it.
If you mean text input caret, you don't want to prevent its motion, because it's used to fill in the text input control.
So, the question, as formulated, makes no sense.

If you mean to capture shifting of the keyboard focus, you can do it by handling some of the focus-related events: blur, change, focus, focusin, focusout:
Event reference | MDN[^].

—SA
 
Share this answer
 
v2
Comments
Agasimani 15-Jan-16 1:09am    
Hi,
I had used the focusout event but its not giving to use new tab in browser and edit the data in Table till i enter the data in the textbox. How to overcome from this...?

Thanks
Sergey Alexandrovich Kryukov 15-Jan-16 1:16am    
Sorry, I cannot understand what you say.

You can use the focus event to capture when the focus is going from the control being validated to some other control. In your handler, you can perform validation and show some indication if the control data/state is invalid.

Franky, I would not go that far. Most general way is to validate all controls on some page or, say, panel, when you are about to use the entered data, say, when you click something like a "Submit" button. But, if you want, you can validate separate controls.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900