HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Open your console (Press F12) and then type something into the input field.</p> <input onkeyup="myLockElement()" onfocus="myFunction()" type="text"> <p><strong>Note</strong>: Once you focus the input field, your mouse pointer will disappear. Press 'Esc' to get back the mouse pointer.</p> <script> var inp = document.getElementsByTagName("input")[0]; function myFunction(){ if(document.pointerLockElement == null) inp.requestPointerLock(); } function myLockElement(){ console.log(document.pointerLockElement); } </script> </body> </html>
OUTPUT
×

Save as Private