koleyang

bootstrap中有alert组件,如果点击关闭按钮后该组件会被删除而不是被隐藏,想再显示怎么办呢?

bootstrap-alert.js源码片段:

function removeElement() {
        $parent
          .trigger(\'closed\')
          .remove()
      }

理论上把.remove()改为.hide(),然后在需要重新显示的地方,加上$(\'#alert\').show();就可以了。

但实际应用中,可以把 close button 的 data-dismiss 去掉,加上 onclick="$(\'#my_alert\').hide();"


这样还是可以用 .show() 显示出来。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-12-02
  • 2021-12-18
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
相关资源
相似解决方案