This is a very simple example how to copy form input data to other form fields. This is useful when the same information entered can be used in other fields such as shipping and billing address forms.
jQuery
$(document).ready(function(){
$("input#same").click(function(){
if ($("input#same").is(':checked'))
{
// Checked, copy values
$("input#shipping-email").val($("input#email").val());
$("input#shipping-name").val($("input#name").val());
$("input#shipping-phone").val($("input#phone").val());
}
else
{
// Clear on uncheck
$("input#shipping-email").val("");
$("input#shipping-name").val("");
$("input#shipping-phone").val("");
}
});
});
HTML
<form>
Billing
Email:<input id="email" name="email" type="text" value="test@example.com" />
Name:<input id="name" name="name" type="text" value="John Smith" />
Phone:<input id="phone" name="phone" type="text" value="(123) 456-7890" />
Shipping
Same?:<input id="same" name="same" type="checkbox" />
Email:<input id="shipping-email" name="email" type="text" />
Name:<input id="shipping-name" name="name" type="text" />
Phone: <input id="shipping-phone" name="phone" type="text" />
</form>






















Very nice information. Check out my blog, I just posted my review of the Awesome free Internet Marketing and SEO tools.
Its a followup to my original post:
http://blogging-to-make-money.com/search-engine-optimization-awesome-new-tools/
Anyways here are the actual reviews and links to the free online tools
Thanks and hopefully this will help you along your travels:
http://blogging-to-make-money.com/free-google-internet-marketing-and-search-engine-optimization-tools
Works great but how do you get it to copy a dropdown….say for the country?
You can use this:
$(“select#category”).change(function(){
var post_string = $(this).val();
});
For an example check out the <select> post:
http://websitebuildersresource.com/2009/02/07/jquery-select-manipulation-multiple-selects-json-default/