Use the document.activeElement
property.
The document.activeElement
property is supported on Chrome 2+, Firefox 3+, IE4+, Opera 9.6+ and Safari 4+.
Note that this property will only contain elements that accept keystrokes (such as form elements).
More Related Contents:
- Write tags in HTML and print
- Get class list for element with jQuery
- Converting user input string to regular expression
- How to prevent Unicode characters from rendering as emoji in HTML from JavaScript?
- Get HTML5 localStorage keys
- Can I run javascript before the whole page is loaded?
- How do I clear the content of a div using JavaScript? [closed]
- Why the onclick element will trigger twice for label element
- How to reorder divs using flex box?
- “.addEventListener is not a function” why does this error occur?
- CSS height 100% percent not working [duplicate]
- Javascript Code works in jsfiddle and but not in the Browser [closed]
- Handling “onclick” event with pure JavaScript
- Is “localStorage” in Firefox only working when the page is online?
- How can I convert numbers into scientific notation?
- HTML5 responsive canvas: resizing the browser canvas draw disappear
- call function on change of value inside tag
- Maximum item size in IndexedDB
- How do I detect the inherited background-color of an element using jQuery/JS?
- multiple pages in Vue.js CLI
- document.activeElement returns body in onblur handler
- minimise the code since I am using the same code only the content in p tags changes and component AccordionHeader header changes
- Rotate div text after clicking on button using jquery and css
- How much data / information can we save / store in a QR code?
- how to use html2canvas and jspdf to export to pdf in a proper and simple way
- Hot to get incomplete datetime-local input values
- html5/Javascript – How to get the Selected folder name?
- Do duplicate ID values screw up jQuery selectors?
- Split text into pages and present separately (HTML5)
- Can you have multiple lines in an element?