Skip to content

Instantly share code, notes, and snippets.

@bakineggs
Created September 10, 2009 05:50
Show Gist options
  • Select an option

  • Save bakineggs/184339 to your computer and use it in GitHub Desktop.

Select an option

Save bakineggs/184339 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('input[type=text]').each(function() {
original_val = $(this).val();
function replace(el, o, r) { if (el.val() == o) el.val(r); }
$(this).focus(function() { replace($(this), original_val, ''); });
$(this).blur(function() { replace($(this), '', original_val); });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment