I am using Bootstrap for my project. The placeholders are displaying fine for all browsers except in Internet Explorer 8 and below.
Are there any solutions to get placeholder support in IE8?
you can use this plugin https://github.com/mathiasbynens/jquery-placeholder Even works in IE6
you can use jquery watermark plugin for that
https://code.google.com/p/jquery-watermark/
It should'nt be to hard to figure this out without a plugin, I'm guessing something close to this will do the trick:
var test = document.createElement('input');
if (!('placeholder' in test)) {
$('input').each(function () {
if ($(this).attr('placeholder') != "" && this.value == "") {
$(this).val($(this).attr('placeholder'))
.css('color', 'grey')
.on({
focus: function () {
if (this.value == $(this).attr('placeholder')) {
$(this).val("").css('color', '#000');
}
},
blur: function () {
if (this.value == "") {
$(this).val($(this).attr('placeholder'))
.css('color', 'grey');
}
}
});
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With