If your form has semicolons, and your using jQuery, in order for it to work you have to use a double backslash for it to work:
This example, when executed, will copy the content from the billing input fields to the shipping input fields <form> <a href="javascript: void(0);" id="update_shipping_address_checkout">Update Shipping</a><input type="text" id="shipping:firstname"> <input type="text" id="shipping:lastname"> <input type="text" id="billing:firstname"> <input type="text" id="billing:lastname"> </form>
<script type="text/javascript"> jQuery(document).ready(function($) { $('#update_shipping_address_checkout').live('click', function() { var partsArray = new Array(); $(':input.billing-data').each(function() { // Split this, using the : as the key // We are gathering information so we know what shipping input fields to populate // Examples are firstname, lastname partsArray = $(this).attr('id').split(':'); // The results are something like: // partsArray[0] = billing // partsArray[1] = firstname // update the related shipping input $( ':input.#shipping\\:' + partsArray[1] ).val( $(this).val() ); }); }); }); </script>