Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
736 views
in Q2A Core by

I am still familiarizing myself with PHP, so this is probably another syntax issue with the single and double quotes, etc.  I'll figure it out eventually, but does anyone have answer on how to insert onfocus onblur into input form so that it clears form when clicked?   I've tried some copy n pasted code but I end up with a blank page or error.  Thanks!

this code doesn't clear it...

<INPUT TYPE="text" placeholder="hello" onfocus="this.value=\''.'\';"   />

 

 

1 Answer

0 votes
by

This is not actually PHP question but HTML related. You can use placeholder="" it does the same thing what you are looking for. You have done almost the same but just remove the value="" form the input field. If you are not calling any value than no need to use it. If you hav

<input type="text" id="full-name" class="long-text" placeholder="Jatin Soni" />

Try above in your code

Or you can do something below

.myclass {
    border: 2px solid #003366;
}
 
<input onfocus="this.className = 'myclass';" onblur="this.className = '';" name="thename" id="thename" type="text" value="Jatin Soni" size="80" maxlength="30">
...