BootStrap的alert提示框的關(guān)閉后再顯示怎么解決

字號(hào):


    這篇文章主要介紹了BootStrap的alert提示框的關(guān)閉后再顯示問題的相關(guān)資料,需要的朋友可以參考下
    bootstrap中有alert組件,如果點(diǎn)擊關(guān)閉按鈕后該組件會(huì)被刪除而不是被隱藏,想再顯示怎么辦呢?
    bootstrap-alert.js源碼片段:
    function removeElement() {
    $parent
    .trigger('closed')
    .remove()
    }
    理論上把.remove()改為.hide(),然后在需要重新顯示的地方,加上$('#alert').show();就可以了。
    但實(shí)際應(yīng)用中,可以把 close button 的 data-dismiss 去掉,加上 onclick="$('#my_alert').hide();"
    這樣還是可以用 .show() 顯示出來。
    以上所述是小編給大家介紹的BootStrap的alert提示框的關(guān)閉后再顯示怎么解決的相關(guān)知識(shí),希望對(duì)大家有所幫助