-1
试图使用Bootbox确认,但我开始用bootbox.alert()
进行测试,但它不起作用。Bootbox警告不起作用
我确认我已经bootstrab.css,bootstrab.js,的jquery.js和 - 包含在网页标题bootbox.min.js:
<link href="{% static "css/patients.css" %}" rel="stylesheet">
<link href="{% static "css/bootstrap.css" %}" rel="stylesheet">
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "css/jquery-ui.min.css" %}" rel="stylesheet">
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "css/bootstrap-datetimepicker.min.css" %}" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
这里我点击时想要生成警报的按钮:
<form id='form' name='delete' action="{% url 'delete_person' person.id %}"
method='POST'>
{% csrf_token %}
<button type='submit' class='btn btn-xs btn-link icon'><i class='glyphicon glyphicon-remove'></i></button>
</form>
在同一的.html文件我有:
<script type="text/javascript">
$(document).ready(function(){
$('.btn').on('click' , function(){
bootbox.alert("hello there!");
});
});</script>
当我点击按钮,什么都没有发生,
我证实,我的浏览器都能够从CDN下载内容, 不知道哪里出了问题。
什么? – circusdei
我在控制台中看不到任何与bootbox相关的东西,我使用了firefox控制台 - > js并使用过滤器在Bootbox上进行过滤 –
您正在收听表单提交按钮,并且您已经为其分配了一个操作。看看这个答案类似的问题:http://stackoverflow.com/a/27328602/185034 – Paul