【发布时间】:2017-06-10 22:25:32
【问题描述】:
我将jquery.blockUI.js 添加到我的html 页面并在脚本中使用它。我的 HTML 页面是:
<form class="form-horizontal" role="form" id="form" method="POST" >
<button type="submit" class="btn btn-default btn_red" id="btnSubmit">Submit</button>
</form>
{% block customjs %}
<script src="js/jquery.blockUI.js"></script>
<script type="text/javascript">
$(document).ajaxStop($.unblockUI);
$(document).ready(function() {
$("#form").submit(function(){$.blockUI({ message: '<h4><img src="/image/gears.gif" />Please wait...</h4>' });
});
</script>
{% endblock %}
这不适用于 Firefox 50.1.0 版本。当我在提交块中使用它时,它将不起作用。我尝试了按钮中的onclick 方法。
<button type="submit" class="btn btn-default btn_red" id="btnSubmit" onclick="testing()">Submit</button>
<script>
function testing() {
$.blockUI({ message: '<h4><img src="/image/gears.gif" />Please wait...</h4>' });
}
</script>
它没有用。最后我也试过了,
$("#btnSubmit").click(function(){$.blockUI({ message: '<h4><img src="/image/gears.gif" />Please wait...</h4>' });
});
这在 Firefox 中也不起作用。但在 Chrome 中工作。所以请给我一个解决方案如何在Firefox上运行它。我正在创建一个 python django 项目,如果没有完成,我将无法继续我的项目。
谢谢
【问题讨论】:
-
你能看到任何 javascript 控制台错误吗?如果是这样粘贴相同..
-
@AbijithMg 没有错误
-
尝试在 html 文件的顶部包含这个 。
-
我将它包含在我的 html 中
-
您在 document.ready 中缺少一个 '})'。但它在 Chrome 中不起作用,也可能由于复制/粘贴而丢失......
标签: javascript django python-2.7 jquery-blockui