jQuery Magic Labels Plugin

by Henrik Joreteg

Provides semantically clean solution for adding in-field labels.

This plugin checks the “for” property of the <label> field and inserts the content of the <label> tag as a placeholder value of the associated <input type="text"> or <textarea> fields.


Check out the demo.


You can download the latest version of this project from GitHub. You can also clone the project with Git by running:

$ git clone git://github.com/HenrikJoreteg/jquery-magic-labels


jQuery 1.2.6 or later should work


simply add the script reference after you import jquery:

<script src="jquery.js"></script>
<script src="jquery.magiclabels.min.js"></script>

Then call magicLabels() function with a selector identifying the form you want to use it on. Like this:


NOTE: in this example I’m using “form”, but it can be any valid selector as long as it grabs forms you wish to apply the effect to.


BSD License