All,
I have a text area field in my for,.How do i clear contents of it on sum onclick using jquery
Thanks.
All,
I have a text area field in my for,.How do i clear contents of it on sum onclick using jquery
Thanks.
$("#textArea").click(function(){ $(this).attr({ value: '' }); });
With a couple of caveats:
$('textarea').focus(function() {
$(this).val('');
});
This will clear the textarea on focus (using mouse click or keyboard).
This will clear the default value onclick and restore back onblur.
$('textarea').click(function () {
if (this.value == this.defaultValue) {
this.value = '';
}
});
$('textarea').blur(function () {
if (this.value === '') {
this.value = this.defaultValue;
}
});