document.activeElement

activeElement is a read only property of document that gives you a reference to the current element that has focus.

Source