Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Created January 10, 2012 19:09
Show Gist options
  • Save thinkerbot/1590557 to your computer and use it in GitHub Desktop.
Save thinkerbot/1590557 to your computer and use it in GitHub Desktop.
Web page tricks
$(function () {
// Activate ghost input text
// <%= text_field_tag :name, @name.blank? ? 'Agent Name' : @name, :class => (@name.blank? ? "inactive" : "active") %>
// input.inactive { color: #D3D3D3; }
$("input.inactive").focus(function() {
input = $(this);
if (input.attr('class') == 'inactive') {
input.attr('value', '');
input.attr('class', 'active');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment