1

I'm using this

$(document).ready(function(){
window.setTimeout(function() {
myVal = "USA";
$("#country").val(myVal);
}, 1000);
});

to auto-select a choice from the select list.

For the select list it loads in the list of states when you select a country:

    <li>
    <label for="country">Country</label>
    <select onchange="print_state('state',this.selectedIndex);" id="country" name = "country"></select>
    </li>
    <li>
    <label for="state">State</label>
    <select name="state" id="state"  class="validate[required]"></select>

    <script language="javascript">print_country("country");</script>
    </li>

So it is selecting USA after a second but it's like it's not actually "clicking" it to make the states appear as well.

4

1 回答 1

0

Try changing the line to:

$("#country").val(myVal).trigger('change');
于 2012-07-12T20:43:39.547 回答