HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Focus the input to lock your pointer.</p> <input 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 elem = document.getElementsByTagName("input")[0]; function myFunction(){ if(document.pointerLockElement == null) elem.requestPointerLock(); } </script> </body> </html>
OUTPUT
×

Save as Private