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

remove the onchange event from your HTML

<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>

and put the jQuery like this:

$("#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 に答える