A simple script to activate the placeholder attribute in older browsers.
Usage:
-add the placeholder normally as you do and the script will do the rest
Example:
<input type="text" placeholder="First name." />
-Place the script at the end of your html file or make sure that the document has loaded completely.
Features :
-You can style the placeholder with css using the class "ph".
-Auto padding , Width & height inheritance.
-Works on IE5.
-No need for server-side verification for such issue, as the text of placeholder is actually a "p" element.
-It is written in plain JS.
Known bugs:
-auto padding inheritance doesn't work in IE9+
--Solution: use the css class to apply the same padding.
getStyle function was taken from : http://robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element