Free Photos
WordPress Themes

JS - onfocus()

<!DOCTYPE html> <html> <body> Enter your name: <input type="text" onfocus="myFunction(this)"> <p>When the input field gets focus, a function is triggered which changes the background-color.</p> <script> function myFunction(x) { x.style.background = "yellow"; } </script> </body> </html>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.