Adds a fallback for browsers that do not support the placeholder attribute.
Probably the most simple solution for this out there.
I found many others where you need extra CSS. This is so simple that you just have to call the class and you have placeholder support for all browsers!
Published under the MIT-License.
Just add the PlaceholderSupport.js to your website and call:
window.addEvent('domready',function(){ new PlaceholderSupport(); });
Will add placeholder functionality to all inputs and textarea elements with a "placeholder" attribute.
window.addEvent('domready',function(){ new PlaceholderSupport('input.myInputWithPlaceholder'); });
Will add the placeholder only to inputs with the class "myInputWithPlaceholder". But this input needs also a placeholder attribute with a text!
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus