Created
November 5, 2012 02:39
-
-
Save tpae/4014995 to your computer and use it in GitHub Desktop.
jQuery IE Placeholder fix
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
$('input,textarea').each(function() { | |
// set this attr placeholder into val, if ie. | |
if ($.browser.msie) { | |
if ($(this).val() == '') { | |
$(this).val($(this).attr('placeholder')); | |
} | |
} | |
}).focus(function() { | |
if ($.browser.msie) { | |
if ($(this).val() == $(this).attr('placeholder')) { | |
$(this).val(''); | |
} | |
} | |
}).blur(function() { | |
if ($.browser.msie) { | |
if ($(this).val() == '') { | |
$(this).val($(this).attr('placeholder')); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment