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> <input type="search" id="mySearch" placeholder="Search field.."> <p>Click the buttons below to give focus and/or remove focus from the search field.</p> <button type="button" onclick="getFocus()">Get focus</button> <button type="button" onclick="loseFocus()">Lose focus</button> <script> function getFocus() { document.getElementById("mySearch").focus(); } function loseFocus() { document.getElementById("mySearch").blur(); } </script> </body> </html>