Edit This Code:
<!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>


Result:
Try it Yourself - © w3schools.com
Privacy Policy