显示模态对话框并停止所有其他事件

时间:2013-02-06 15:22:19

标签: jquery events

当访客选择 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();"

而导致页面重新加载的模式展示了几个secondes和soudanly

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

1 个答案:

答案 0 :(得分: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
           }
       });
    }
});