jQuery - Why won't select box info duplicate but the rest will
<p>I'm using the code below to try and duplicate information from one set of address fields to another set when a checkbox is checked. All of it works except for the state select box (drop down box). It's driving me crazy. </p>

<pre><code> //on page load
 $(document).ready(function() {

//when the checkbox is checked or unchecked
$('#copyaddress').click(function() {

    // If checked
    if ($(this).is(":checked")) {

        //for each input field
        $('#cc input', ':visible', document.body).each(function(i) {
            //copy the values from the billing_fields inputs
            //to the equiv inputs on the shipping_fields
            $(this).val($('#info input').eq(i).val());
        });
        //won't work on drop downs, so get those values
        var c_state = $("select#c_state").val();

        // special for the select
        $('select#cc_state option[value=' + c_state + ']').attr('selected', 'selected');

    } else {

        //for each input field
        $('#cc input', ':visible', document.body).each(function(i) {
            // put default values back
            $(this).val($(this)[0].defaultValue);
        });

        // special for the select
        $('select#cc_state option[value=""]').attr('selected', 'selected');
         }
     });
 });
</code></pre>
