I want a textarea with some default text. When the user clicks in the textarea the default text should be deleted. How can I make value of a textarea disappear on click?
<
$('#textarea').click(function(){
if($(this).val() == "This should be removed.."){
$(this).val() = "";
}
});
//edit
var defaultTextAreaValue = "This should be removed..";
$('#textarea').focus(function(){
if($(this).val() == defaultTextAreaValue){
$(this).val("");
}
});
$('#textarea').blur(function(){
if($(this).val() == "" || $(this).val() == defaultTextAreaValue){
$(this).val(defaultTextAreaValue);
}
});