I am editing the form for a WordPress login and want to remove text from a field when clicked on.
I found a solution, but cannot get it working correctly... here is the code:
<input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="Username" size="20" onfocus="' . if(this.value == 'Username') { this.value = ''; } . '" onblur="' . if(this.value == '') { this.value = 'Username'; } . '" />
I added the onfocus and onblur, but it throws back an error:
Parse error: syntax error, unexpected 'if' (T_IF)
I have obviously done it incorrect, but not sure on the correct way of doing so. Any help would be appreciated.
Thanks