Is there a hasFocus property or method on the plugin UI controls?



I’m trying to find if a text input has focus when the enter key is pressed (form submit).

Is there a hasFocus property on the UI components?

Or is there a property on the form submit event that refers to the target that has focus? The currentTarget is referring to the button even when another input has focus when I press the enter key.


Hmm… not at the moment I don’t think. Once we have :focus pseudo selector, you could get the currently focused control that way. We also don’t have document.activeElement yet.

If you’re trying to prevent ENTER from working while a text field is focused, you can use the keydown event on text fields and just call evt.preventDefault() if the key code is 13.