Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // copy billing to shipping
- $('input#billCopy').click(function() {
- // If checked
- if ($(this).is(":checked")) {
- //for each input field
- $('#shipFields input', ':visible', document.body).each(function(i) {
- //copy the values from the billing inputs
- //to the equiv inputs on the shipping inputs
- $(this).val($("#billFields input").eq(i).val());
- });
- //won't work on drop downs, so get those values
- var billState = $("select#billState").val();
- // special for the select
- $('select#shipState option[value=' + billState + ']').attr('selected', 'selected');
- }
- else {
- //for each input field
- $('fieldset#shipFields input', ':visible', document.body).each(function(i) {
- // put default values back
- $(this).val($(this)[0].defaultValue);
- });
- // special for the select
- $('select#shipState option[value=""]').attr('selected', 'selected');
- } // end if else
- }); // end copy bill to ship function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement