0

当访客选择Cape Cod Local Van Delivery 1.00 美元时,我正在尝试打开一个模式对话框

<select name="ShippingSpeedChoice" onchange="this.form.submit();" style="">
    <option value="0">PLEASE SELECT</option>
    <option value='101' >Free Shipping (UPS Ground) </option>
    <option value='1001'>Cape Cod Local Van Delivery $1.00 </option>
</select>

我的脚本:

$("#v65-cart-shipping-details select").change(function(event) {
if (this.value == '1001'){
    $("#dialog-modal").dialog({
    height: 140,
    modal: true
    });
}
});

模态显示几秒钟,并且页面重新加载由于onchange="this.form.submit();"

我需要停止此事件,直到我关闭模式对话框

4

1 回答 1

0

从您的 HTML 中删除 onchange 事件

<select name="ShippingSpeedChoice" style="">
    <option value="0">PLEASE SELECT</option>
    <option value='101' >Free Shipping (UPS Ground) </option>
    <option value='1001'>Cape Cod Local Van Delivery $1.00 </option>
</select>

并像这样放置jQuery:

$("#v65-cart-shipping-details select").change(function(event) {
    if (this.value == '1001'){
       $("#dialog-modal").dialog({
           height: 140,
           modal: true,
           close:function(){
              // form submit action here
           }
       });
    }
});
于 2013-02-06T15:35:03.397 回答