jQuery Plugin to set form input default values from labels
Author: Marc Loehe, http://marcloehe.de
-
Be sure to have your text inputs and textareas provided with labels correctly.
<label for="mytextinput">Name of my text input</label> <input type="text" name="mytextinput" id="mytextinput" /> -
Include jQuery in your page.
-
Include the plugin in your page.
Either load it separatly...
<script type="text/javascript" src="js/jquery.defaultvalues.js"></script>...or copy and paste it into some piece of code your using anyway.
-
Call DefaultValues on a parent element of your inputs (preferably the
<form>)after the DOM is loaded.$(document).ready(function() { $('#myform').DefaultValues(); }); -
You may want to provide a way to hide the now obsolete labels via css and js-detection.
2012-03-10 Initial release