jQuery check element has focus
//test if element has focus in jQuery
if ($("#myElementID").is(":focus")) {
//I have the focus
}
//test if element has focus in plain Javascript
var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
//myElement Has Focus
}
var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
//myElement Has Focus
}
Also in JavaScript:
- javascript reverse array without modifying
- align left text in reactstrap
- jquery validate on keyup
- javascript give class to element
- multiple ternary operator javascript
- "withAuth.js" in react
- get page link angular
- react state array push
- jQuery UI Sortable, then write order into a database
- how to check if variable is array in javascript
- insert json into sql
- sum array without loop javascript
- jednorozeclinda
- javascript loop last index
- javascript hash string
- how to use react fragment
- email validation regex
- class component react
- vuetify event handler
- canvas fillrect
- back press subscriptions i is not a function react native
- how to print numbers in javascript
- page not found vue
- js if not undefined