Answers for "how to get focus on element javascript"

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
13

set focus javascript

document.getElementById("ThingToSetFocusOn").focus();
Posted by: Guest on February-11-2020
0

Javascript find element with focus

var currentElementWithFocus=document.activeElement;
Posted by: Guest on July-23-2019

Code answers related to "how to get focus on element javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language