Return to Snippet

Revision: 19569
at October 26, 2009 05:58 by cesgra


Initial Code
$('.default-value').each(function() {

       var default_value = this.value;

       $(this).focus(function(){
               if(this.value == default_value) {
                       this.value = '';
               }
       });

       $(this).blur(function(){
               if(this.value == '') {
                       this.value = default_value;
               }
       });

});

Initial URL
http://css-tricks.com/snippets/jquery/setclear-default-input-value/

Initial Description

                                

Initial Title
Set/Clear Default Input Value

Initial Tags

                                

Initial Language
jQuery