Return to Snippet

Revision: 55834
at February 23, 2012 21:10 by hoogvlieger


Initial Code
$('input:text').focus(function(){
  if($(this).val() == $(this).attr('defaultValue')){
	  $(this).val('');
  }
});

$('input:text').blur(function(){
  if($(this).val() == ''){
	   $(this).val($(this).attr('defaultValue'));
  }
});

 $('textarea').focus(function(){
  if($(this).val() == $(this).attr('defaultValue')){
	  $(this).val('');
  }
});

$('textarea').blur(function(){
  if($(this).val() == ''){
	   $(this).val($(this).attr('defaultValue'));
  }
});

Initial URL

                                

Initial Description
Remove initial inputfield value on focus.. and place it back on blur in case of empty value.

Initial Title
Remove initial inputfield value on focus.. and place it back on blur in case of

Initial Tags
javascript

Initial Language
JavaScript