Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE HTML> <html> <head> <title>Title of the Document</title> <style> .focused { outline: 1px solid red; } </style> </head> <body> <form id="form"> <input type="text" name="firstname" value="FirstName"> <input type="text" name="lastname" value="LastName"> </form> <script> form.addEventListener("focusin", () => form.classList.add('focused')); form.addEventListener("focusout", () => form.classList.remove('focused')); </script> </body> </html>