Return to Snippet

Revision: 46332
at May 17, 2011 19:44 by dubogii


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