The pointerLockElement property of the Document and ShadowRoot interfaces provides the element set as the target for mouse events while the pointer is locked. It is null if lock is pending, pointer is unlocked, or the target is in another document.


var element = document.pointerLockElement;

Return value

An Element or null.


Specification Status Comment
The definition of 'pointerLockElement' in that specification.
Candidate Recommendation Extend the Document interface

Browser compatibility

BCD tables only load in the browser

See also