Bootstrap警报不会显示
问题描述:
我已将页面从BS2转换为BS3,并且无法将警报显示在诊断日志上。我缩小了一个简单的例子。我必须错过一些基本和明显的东西!Bootstrap警报不会显示
<div class="alert alert-danger hide" id="form-error">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
×
</button>
</div>
<a href="#" class="btn btn-primary btn-large" type="button" onclick="mysavefunction()" id="trev">Press me</a>
保存看起来像这样
$('#form-error').html("<p>error message").show();
答
我猜show()
不工作,因为类hide
犯规此功能得到去除,所以我宁愿攻皮类:
$('#trev').click(function() {
$('#form-error').html("<p>error message</p>").toggleClass('hide');
});
此结果显示您的表单错误。