Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>Use select() to select the content of a Number Field</h2> A Number: <input type="number" id="myNumber" value="2"> <p>Click the button to select the content of the number field.</p> <button type="button" onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("myNumber").select(); } </script> </body> </html>