Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* README. Ping!

  • Loading branch information...
commit 4c4cdf77e10e297d80da432da4efe061e47c3ec6 1 parent 2cd83b1
@cpojer authored
Showing with 61 additions and 0 deletions.
  1. +61 −0 README.md
View
61 README.md
@@ -0,0 +1,61 @@
+Form Placeholder
+=============
+
+Provides a fallback for the placeholder property on input elements for older browsers. Does not actually do anything in modern browsers.
+
+Build
+-----
+
+Build via [Packager](http://github.com/kamicane/packager), requires [MooTools Core](http://github.com/mootools/mootools-core) and [MooTools Class-Extras](http://github.com/cpojer/mootools-class-extras) to be registered to Packager already
+
+
+ ./packager register /path/to/form-placeholder
+ ./packager build Form-Placeholder/* > form-placeholder.js
+
+To build this plugin without external dependencies use
+
+ ./packager build Form-Placeholder/* +use-only Form-Placeholder > form-placeholder.js
+
+Demo
+----
+
+See Demos/index.html
+
+How To Use
+----------
+
+Create a new instance of Form.Placeholder for your TextArea-Element
+
+ new Form.Placeholder('myInput');
+
+To check if the browser supports placeholders use
+
+ if (Form.Placeholder) // This browser supports placeholders
+
+Note that Form.Placeholder is forced in previous versions of Safari (<= 4). Safari 4 appears to support the placeholder property, but it contains bugs.
+
+Options
+-------
+
+* defaultColor (number, defaults to *#777*): The color to be used for the placeholder text
+* defaultValue (number, defaults to *null*): The default value to be used if no placeholder property was provided
+
+Tips
+--------
+
+Use the following tips to get most out of Form.Placeholder.
+
+Style the color of the placeholder via CSS in Webkit based browsers
+
+ input::-webkit-input-placeholder {
+ color: #000;
+ }
+
+Note that not all modern browsers support to modify the placeholder color yet. If you absolutely need to change the placeholder color, you can force using Form.Placeholder
+
+ <script type="text/javascript">
+ // Force usage of Form.Placeholder in *all* browsers
+ var supportsPlaceholder = false;
+ </script>
+
+Note: Currently, in browsers without placeholder support, typing the same value as the placeholder will remove the content when you focus the input element again. Given that usually the placeholder is not a useful input value in the context of an application this is intentional. However, I am happy to pull from a fork if someone chooses to fix this (in a sane and simple way).
Please sign in to comment.
Something went wrong with that request. Please try again.