Skip to content

Instantly share code, notes, and snippets.

@jweisber
Last active August 29, 2015 14:18
Show Gist options
  • Save jweisber/df16d8956b2e08b3de4e to your computer and use it in GitHub Desktop.
Save jweisber/df16d8956b2e08b3de4e to your computer and use it in GitHub Desktop.
Workaround for IE 10/11 textarea placeholder bug
// Work around a bug in IE 10/11: http://tinyurl.com/qykro7d
// The bug makes any empty textarea's placeholder its value.
// We undo that wherever it's happened.
jQuery(function() {
$('textarea').each(function() {
if ($(this).val() === $(this).attr('placeholder')) {
$(this).val('');
}
});
});
# Same thing in coffeescript
jQuery ->
$('textarea').each ->
if $(this).val() == $(this).attr('placeholder')
$(this).val ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment