I have a text input field. When clicked, I want to change the text color style using JavaScript. Previously, I successfully achieved clearing the inner content of the textbox when clicked and reverting to the default version on blur. This code is currently functioning as intended.
<input id="username" type="text" name="username" value="Enter Username..." onfocus="if(this.value=='Enter Username...') {this.value='';} onblur="if(this.value==''){this.value='Enter Username...'}"/>
However, now I also want to change the text color and border size of the textbox when it is focused. The current code is not producing the desired effect.
<input id="username" type="text" name="username" value="Enter Username..." onfocus="if(this.value=='Enter Username...') {this.value=''; document.getElementById('username').style.color = 'blue';}" onblur="if(this.value==''){this.value='Enter Username...'; document.getElementById('username').style.color = '#fff'; }"/>