Hide and show function not working in Safari

2019-01-29 07:54发布

This function should stop displaying the #bt_pagamento and start showing the #bt_loading. But Safari (version 6) is the only browser that this function doesn't work. In early versions of Safari (version 5.1.9 Mac and 5.1.7 Win) it worked perfectly.

$("#bt_pagamento").click(function () {
$(this).css({'display':'none'});
$("#bt_loading").show();
});

Does anyone know a work around for this?

2条回答
手持菜刀,她持情操
2楼-- · 2019-01-29 08:22

CSS

<style>
.hide { display: none; }
</style>

HTML

<a href="#" id="bt_pagamento">link</a>
<div id="bt_loading" class="hide">
    this is bt_loading
</div>

JS

$(document).ready(function() {
    $("#bt_pagamento").click(function (e) {
        e.preventDefault();
        $(this).addClass('hide');
        $("#bt_loading").removeClass('hide');
    });
});
查看更多
你好瞎i
3楼-- · 2019-01-29 08:34
<script>
jQuery.noConflict()(document).ready(function() {
    $('#hide_value_discount_1').css('disabled','none');
    $('#bt_loading').click()(function(){

        if(document.getElementById('bt_pagamento').click()){
            $('#bt_loading').show('slow');  

        }else
            if(document.getElementById('bt_pagamento').click() == false){
             $('#bt_loading').css('display','none');    

            }

    });
    $('#bt_pagamento').click();
});
</script>


<a href="#" id="bt_pagamento">link</a>
<div id="bt_loading" class="hide">
    this is bt_loading
</div>
查看更多
登录 后发表回答