Skip to content

Instantly share code, notes, and snippets.

@mduvall
Created November 23, 2011 01:38
Show Gist options
  • Save mduvall/1387683 to your computer and use it in GitHub Desktop.
Save mduvall/1387683 to your computer and use it in GitHub Desktop.
test fade input like squareup.com
<html>
<head>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<style type="text/css">
input#email { z-index:1; height:27px; }
label[for='email_label'] { z-index:0; position:absolute; }
</style>
<script type="text/javascript">
$("input").live({
focus: function() {
$(this).keypress(function() {
$("label[for='" + this.id + "_label']").fadeOut();
})}
});
</script>
</head>
<label for="email_label">
Email address
</label>
<input class="xlarge" id="email" type="text">
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment