/ Published in: jQuery

This should enable you to clear elements such as search boxes effectively whilst maintaining usability.
Enjoy!
Enjoy!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('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 ); } } ); } );
Comments
