/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
swapValues = []; $(".text_input_values").each(function(i){ swapValues[i] = $(this).val(); $(this).focus(function(){ if ($(this).val() == swapValues[i]) { $(this).val(""); } }).blur(function(){ if ($.trim($(this).val()) == "") { $(this).val(swapValues[i]); } }); });