Return to Snippet

Revision: 47922
at June 18, 2011 06:07 by Fitzgenius


Initial Code
$('input[type=text]').each( function() {
    var input = $(this); var inputVal = input.val();	
    input.focus( function(){ if( input.val() != inputVal ) { return false; } input.val(''); } );
    input.blur( function(){ if( input.val() == '' ) { input.val( inputVal ); } } );	
} );

Initial URL

                                

Initial Description
This should enable you to clear elements such as search boxes effectively whilst maintaining usability.

Enjoy!

Initial Title
jQuery Text Clear and Restore

Initial Tags
form, jquery

Initial Language
jQuery