Samantha Groves
Coder
Hello!I have this code:
I would like the text of my textbox to change color when it is on focus(or selected) but it doesnt change and I dont know where I am wrong.Any help?
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>IP Address Info</title>
</head>
<body>
<script>
</script>
<label style="background-color:whitesmoke;color: black;position:fixed;top:20px;left:20px;width:100px;height:20px; font-family:Verdana">IP Address
</label>
<label style="background-color:whitesmoke;color: black;position:fixed;top:20px;left:340px;width:200px;height:20px; font-family:Verdana">Subnet mask
</label>
<input type="text" id="ipAddressId" style="background-color:whitesmoke;color:gray;position:fixed;border-color:whitesmoke;top:120px;left:20px;font-family:Verdana;width:200px;height:20px; border-radius:8px" onfocus="function f(){this.HTMLElement().setAttribute('color','black')}">
</body>
</html>
I would like the text of my textbox to change color when it is on focus(or selected) but it doesnt change and I dont know where I am wrong.Any help?