Hi I want to prevent users from using the enter key unless they are in a specific text area on my form . I can stop the enter button being used but how can I find out which part of my form is in focus using js ? Any help would be great , thanks
Share
You can assign a global variable. With jquery:
Although the use of globals is quite discouraged, it’s the fastest way and you can check for the global anywhere in your script. If you don’t use jquery you can use this shortened function:
EDIT (from this answer):