Input Textfield Default Value

A jQuery class to insert a default value in a textfield which will disappear on focus, and re-appear if the field is empty on blur.

var defaultInputValue = (function( $ )
{
    this.bind = function( obj, text )
    {
        $( obj ).each(function( index ) {
            
            if( getFieldValue( this ) == '' )
            {
                $( this )
                    .val( text )
                    .addClass( 'novalue' )
                ;
            }
            
            $( this )
                .on( 'focus', function()
                {
                    if( getFieldValue( this ) == text)
                    {
                        $( this )
                            .val( '' )
                            .removeClass( 'novalue' )
                        ;
                    }
                })
                .on( 'blur', function()
                {
                    if( getFieldValue( this ) == '')
                    {
                        $( this )
                            .val( text )
                            .addClass( 'novalue' )
                        ;
                    }
                })
            ;
        });
    }
    
    function getFieldValue( obj )
    {
        return $( obj ).val();
    }
    
    return this;
    
})( jQuery );

// Use the class on any input field you want by passing the
// selector and the default value.
jQuery(document).ready(function() {
    defaultValue.bind( '#footer input.name', 'name' );
    defaultValue.bind( 'input.email', 'email address' );
});