我有这个返回给我的javascript代码导致警报窗口
$(".average").click(function () {
alert(average())
});
但是,现在我想在bootstrap模态窗口中显示该结果。如何在模态中显示结果?谢谢!
答案 0 :(得分:1)
使用Bootstrap模态的the example from the documentation,您只需将平均函数的结果插入模态体中,然后显示模态。假设您的模态的ID为#myModal
:
$(".average").click(function () {
var result = average();
$("#myModal .modal-body p").text(result);
$("#myModal").modal();
});
查看上面的文档链接,了解有关Boostrap模式的更多信息,以及传递给它的选项。