Created
March 25, 2012 19:55
-
-
Save shodanuk/2199360 to your computer and use it in GitHub Desktop.
Quick and dirty input placeholder shim using jQuery + Modernizr (Tested in IE7 + 8)
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
$('.lt-ie9 input[placeholder], .lt-ie9 textarea[placeholder]').each(function(){ | |
var $this = $(this), | |
placeholder = $this.attr('placeholder'); | |
$this.addClass('placeholder').val(placeholder); | |
$this.focus(function() { | |
$this.val(''); | |
}).blur(function() { | |
if ($this.val() === '') { | |
$this.val(placeholder); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment