onfocus="clearContents(this)
perfect. it clears out the default text in the textarea like a charm. however, when i try to type something else and click it again, everything gets cleared out again! i only want the textarea to be cleared on the FIRST click. how do i fix this??
_______________________________________________________________________________
this is what i have in my java file - what else do i need to add/do?!
function clearContents(element) {
element.value = '';
}
THANKS!
Verified answer
if you wish to clear the contents of a form its simple.
<input type="button" value="clear" onclick="this.form.reset()" />
get rid of your current javascript it isn't needed ad the button above and it will place a second button on the form when clicked it will clear the form it is associated with and still allow you to re type.
And your current problem is because you specified on focus so everytime you focus it will clear its pointless because if you limited to just the first time what if the user makes an error and wants to delete it again? They can't
Clear Textarea