Here’s my code for the text area.
<textarea style="width: 95%;" rows="6" name="feedback[<?=$r_uid;?>]" disabled="disabled" onclick="this.value='';" onblur="this.value=!this.value?'No feedback provided':this.value;" maxlength="800"></textarea>
When a user clicks it, it clears out. And if they leave it blank, the text “No feedback provided” appears. However, if they type something else and click outside the box, the text area retains it.
The problem, however, is if they click inside the box. The new text typed in is cleared out. Is there a way to prevent it from clearing out if a new text is typed in?
Thanks!
Add this to your onClick event:
…
Note that you only targeting
click! what about keyboard navigation? useonfocusinstead ofonclick:Note that inline scripts are deprecated and hard to read and maintain.