jQuery的。调用onchange处理函数

时间:2013-06-10 13:01:25

标签: jquery onchange

在select I中使用jquery以编程方式更改选项然后我想调用onchange动作。我有这个HTML代码:

<select onchange="billing.newAddress(!this.value)" id="billing-address-select" name="billing_address_id">
   <option value="1">value1</option>
   <option value="2">value2</option>
   <option value="3">value3</option>
</select>

和javascript:

jQuery(document).ready(function($) {

    $('#billing-address-select').change(function(e){
       if (sAddressType == 'school') {
        $("#billing-address-select option[value='2']").attr("selected", "selected");
        }
    });
    $('#billing-address-select').trigger('change'); 
})(jQuery);

所以,实际上在加载页面后如果条件为真,则执行changin'cinging-address-select'然后调用onchange(billing.newAddress(!this.value))动作。但这个动作不打电话。错在哪里?

抱歉我的英文。感谢。

0 个答案:

没有答案
相关问题