What do you all use to support placeholder attributes in browsers?
Currently, am using:
https://github.com/mathiasbynens/Placeholder-jQuery-Plugin
Have also tried this plugin to no avail:
https://github.com/danbentley/placeholder
But it doesn’t seem to work with IE… More specifically IE 8. Any other suggestions / alternatives?
Should I forget about the placeholder attribute for now?
You’re right that IE8 doesn’t support the
placeholderattribute.placeholderis part of the HTML5 spec, and IE8 was released a long time before HTML5 was thought of.The best way to deal with it in a seamless manner is to use a tool like Modernizr to detect whether the browser has support for the placeholder feature, and run a JS polyfill script if it isn’t supported.
There are numerous placeholder polyfill scripts out there to download. Pick one which makes use of the
placeholderattribute so that you only need to define the placeholder string in one place for all browsers. Here’s one you could try: http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.htmlHope that helps.