Revision: 28767
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 14, 2010 03:15 by iqwebdev
Initial Code
var origValue = []; $('input.remember').each ( function (currentIndex) { origValue.push ( $(this).val () ); $(this).focus ( function () { $(this).removeClass("unfocused"); var defaultText = $(this).val(); if ( $(this).val () == origValue [ currentIndex ] ) { $(this).val(''); } $(this).blur(function() { var userInput = $(this).val(); if (userInput == '') { $(this).val(defaultText); $(this).addClass("unfocused"); } }); }); });
Initial URL
Initial Description
A jQuery snippet to make form inputs show a help message which disappears on click (and comes back when the user enters nothing). Give your input the classes ‘remember’ to activate the snippet and (optionally) ‘unfocused’ as a CSS hook for changing the styling of the help message.
Initial Title
Inputs That Remember Original Value
Initial Tags
forms
Initial Language
jQuery