jQuery Plugin To Auto Copy Text From One Field To Another - autofill

File Size: 95.3 KB
Views Total: 8094
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Auto Copy Text From One Field To Another - autofill

autofill is a fast, easy and useful jQuery plugin that automatically copy and fill out text input fields from another text input fields. Useful to prevent from having to fill out the form twice or more (e.g. domain registration).

How to use it:

1. Load the jQuery javascript library and jQuery autofill plugin in the page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="jquery.autofill.js"></script>

2. The Html.

<label for="fname">Firstname</label>
<input id="fname" name="fname" type="text"/>

<label for="lname">Lastname</label>
<input id="lname" name="lname" type="text"/>

<label for="cemail">E-Mail</label>
<input id="cemail" type="text" name="cemail"/>

<input id="firstname" name="firstname" type="text" />
<label>Filled first time.</label>

<label for="lastname">Lastname</label>
<input id="lastname" name="lastname" type="text" />
<label>Filled first time.</label>

<label for="uemail">E-Mail</label>
<input id="uemail" type="text" name="uemail"/>

3. Call the plugin after DOM ready.

<script>
$().ready(function() {
$("#fname").autofill({
fieldId : "firstname",
overrideFieldEverytime : false
});
		
$("#lname").autofill({
fieldId : "lastname",
overrideFieldEverytime : false
});

$("#cemail").autofill({
fieldId : "uemail",
overrideFieldEverytime : true
});

});
</script>

Change log:

2017-06-05

  • Version 1.2.1

This awesome jQuery plugin is developed by harshen. For more Advanced Usages, please check the demo page or visit the official website.