javascript - Clear TEXTAREA value after click (onFocus) -


i'm using..

onfocus="this.value=''; return false;" 

to clear value within textarea leaving comments. however, when click enter comment , type few things, if click outside box maybe read else on page , return comment clicking within textarea box again, clears current input.

is there anyway clear textarea on initial click clear default value , not rest of clicks rest of browser page's session?

it's better put instructions label tag, position on textarea, , hide or show if textarea focused. reason because textearea populated instructions , these might sent if inside form.

but, solve problem, have is:

onfocus="if(this.value== "your initial text"){this.value=''}; return false;" 

Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -