Revision: 13760
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 5, 2009 16:11 by keith
Initial Code
swapValue = []; $(".swap-value").each(function(i){ swapValue[i] = $(this).val(); $(this).focus(function(){ if ($(this).val() == swapValue[i]) { $(this).val(""); } $(this).addClass("focus"); }).blur(function(){ if ($.trim($(this).val()) == "") { $(this).val(swapValue[i]); $(this).removeClass("focus"); } }); });
Initial URL
Initial Description
The markup would look like this: <code> <input class="swap-value" type="text" value="Search"/ ></code>
Initial Title
Toggle INPUT value on focus
Initial Tags
form, jquery
Initial Language
jQuery