刚遇到这个问题,没找到好办法。不过用了笨笨的方法实现了。 默认隐藏: 错误:请输入您的用户名! 显示的时候: $("#alert-user").attr("class","alert alert-danger"); 如果需要关闭,不能用 .alert("close")。这样就再显示不出来了。