How to copy the shipping address to billing address

Posted by Jerry on Stack Overflow See other posts from Stack Overflow or by Jerry
Published on 2010-04-25T01:02:03Z Indexed on 2010/04/25 1:03 UTC
Read the original article Hit count: 459

Filed under:
|
|
|
|

Hi all I like to know if I can copy the shipping address to billing address. I got most of the parts done but I am not sure how to copy select menu (states) value to billing address. I really appreciate any helps.

My code

$(document).ready(function(){

Jquery

$('#same').click(function(){
    if($('#same').attr('checked')){
        $('#bfName').val($('#fName').val());
        $('#blName').val($('#lName').val());
        $('#baddress1').val($('#address1').val());
        $('#baddress2').val($('#address2').val());
        $('#bcity').val($('#city').val());
        alert(($('#state option:selected').val())); //not sure what to do here
        $('#bzip').val($('#zip').val());

};

});

Html

<td><select name="state">            //shipping states......only partial codes.
    <option value="">None
    <option value="AL">Alabama
    <option value="AK">Alaska
    <option value="AZ">Arizona
    <option value="AR">Arkansas
    <option value="CA">California
    <option value="CO">Colorado
    <option value="CT">Connecticut
        </select></td>


   <td><select name="bstate">    //billing state................only partial codes.
    <option value="">None
    <option value="AL">Alabama
    <option value="AK">Alaska
    <option value="AZ">Arizona
    <option value="AR">Arkansas
    <option value="CA">California
    <option value="CO">Colorado
    <option value="CT">Connecticut
        </select></td>

Thanks a lot!

© Stack Overflow or respective owner

Related posts about html

Related posts about jQuery