You need two handlers, one for those when the element gets focus, and the other for when it loses focus. When it receives focus, check if the value is just spaces, and if so, set the default value.
$('#textarea').focus( function(){ var $this =$(this); if($this.val() == 'This should be removed..'){ $this.val(''); } }).blur(function() { var $this = $(this); if ($this.val().match(/^\s*$/) {
tvanfosson
source share