Revision: 37664
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 15, 2010 01:51 by digitalclubb
Initial Code
function initInput(setDefault) { var inputValues = {}; if (setDefault == null) setDefault = false; $('input:text, input:password').each(function() { if (setDefault) inputValues['' + $(this).attr('id') + ''] = $(this).val(); $(this).focus(function() { if ($(this).val() == inputValues[$(this).attr('id')]) $(this).val(''); }); $(this).blur(function() { if ($(this).val() == '') $(this).val(inputValues[$(this).attr('id')]); }); }); }
Initial URL
Initial Description
Simply run the function when the document has loaded and specify setDefault to true.
Initial Title
jQuery function to clear inputs
Initial Tags
jquery, function
Initial Language
jQuery