Last active
August 29, 2015 13:56
-
-
Save Agneli/8974886 to your computer and use it in GitHub Desktop.
Placeholder effect with jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--HTML--> | |
<input type="text" name="email" id="email" value="digite seu e-mail" /> | |
<!--Javascript (jQuery)--> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
$("#email").focus(function() { | |
if ($(this).val() === "digite seu e-mail") { | |
$(this).val(""); | |
} | |
}); | |
$("#email").focusout(function() { | |
if ($(this).val() === "") { | |
$(this).val("digite seu e-mail"); | |
} | |
});{ | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment