Created
August 17, 2013 12:20
-
-
Save ribeiroevandro/6256658 to your computer and use it in GitHub Desktop.
Placeholder com jQuery e HTML5
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
| $(document).ready(function(){ | |
| $('.inputs[placeholder]').each(function(){ | |
| var ph = $(this).attr('placeholder') | |
| $(this).val(ph).focus(function(){ | |
| if($(this).val() == ph) $(this).val('') | |
| }).blur(function(){ | |
| if(!$(this).val()) $(this).val(ph) | |
| }) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment