why does IE need for me to click twice

后端 未结 1 1484
慢半拍i
慢半拍i 2021-01-15 01:40

I have this jQuery

    $(\'.billing_info\').click(function(e){
        e.preventDefault();
        if(($(\'.shipping_selection\').length) > 0){
                  


        
相关标签:
1条回答
  • 2021-01-15 02:33

    Perhaps a bit of refactoring would help. Only prevent default when you need to, otherwise let the function pass through to the default submit event.

    $('.billing_info').click(function(e){
        if(($('.shipping_selection').length) > 0 && $('.shipping_selection:checked').length == 0){
                e.preventDefault();
                $('.hide_error').show();
                $("html, body").animate({ scrollTop: $(".hide_error").offset().top }, "slow");
                $(".hide_error").effect("highlight", {}, 4000);
                return false;
        }
    });
    
    0 讨论(0)
提交回复
热议问题