如何使用按鈕隱藏bpopup jquery?我有一個Ajax響應,如果數據返回錯誤失敗bpopup將被調用。然後在我的bpopup裏面我有一個「明白了!」按鈕,當用戶點擊它,它只會關閉bpopup如何隱藏bpopup jquery?
$.ajax({
url: 'my_url',
type: "POST",
success: function(data){
if(data.error == 'failed){
$('#popup').bPopup({
modalClose: false,
opacity: 0.6,
positionStyle: 'fixed'
});
//then my bpopup has a button "Got it!"
$('.gotit').click(function(e) {
//Code the will hide the bpopup.
}
}
}
})
我已經嘗試$('#popup).hide();
但它並沒有完全關閉的bpopup
。
BTW這裏是我的彈出式HTML。
<div id="popup" style="display: none; min-width: 350px;">
<span class="button b-close"><span>X</span></span>
<div class="col-lg-12">
<p><span class="ui-icon ui-icon-alert"></span> The Code does not match the information provided.</p>
<button class="btn btn-primary btn-sm pull-right gotit">Got it</button>
</div>
</div>
你意識到上面的代碼中有一個錯誤,對嗎?成功函數中缺少''''。 – Scott
對不起。 – p3ac3