Answers for "js how to get focused input element"

1

jquery get current focus element

// Get the focused element:
var $focused = $(':focus');

// No jQuery:
var focused = document.activeElement;

// Does the element have focus:
var hasFocus = $('foo').is(':focus');

// No jQuery:
elem === elem.ownerDocument.activeElement;
Posted by: Guest on April-30-2020

Code answers related to "js how to get focused input element"

Code answers related to "Javascript"

Browse Popular Code Answers by Language