Created
January 12, 2012 15:36
-
-
Save athanassiadis/1601153 to your computer and use it in GitHub Desktop.
Modernizr placeholder
This file contains 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
if (!Modernizr.input.placeholder){ | |
$('input[type=text]').each( function(){ | |
$(this).attr('value', $(this).attr('placeholder') ) | |
.focus( | |
function(){ | |
var ph = $(this).attr('value'); | |
$(this).attr('value','').blur( function(){ | |
if($(this).attr('value').length < 1 ){ | |
$(this).attr('value', ph); | |
} | |
}) | |
}); | |
} ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment