I add jquery.blockUI.js to my html page and I used it in the script. My HTML page is:
<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 %}
This is not working in Firefox 50.1.0 version. When I use this into the submit block it will not work. I tried the onclick method in button.
<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>
It did not worked. Finally I tried this also,
$("#btnSubmit").click(function(){$.blockUI({ message: '<h4><img src="/image/gears.gif" />Please wait...</h4>' });
});
This is also not working in firefox. But worked in Chrome. So please give me a solution how to run this on firefox. I am creating a python django project and I can't continue my project without getting this done.
Thanks
Your first code snippet seems to have error, it's missing ending of document.ready(). Also have you tried preventing default on form submit.
I have tested this with preventDefault() and seems to be working on firefox and chrome. Withount preventDefault() there should be error on console after submit.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<form class="form-horizontal" role="form" id="form" method="POST" >
<button type="submit" class="btn btn-default btn_red" id="btnSubmit">Submit</button>
</form>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="http://malsup.github.io/jquery.blockUI.js"></script>
<script type="text/javascript">
$(document).ajaxStop($.unblockUI);
$(document).ready(function(){
$("#form").submit(function(e){
e.preventDefault();
$.blockUI({ message: '<h4><img src="/image/gears.gif" />Please wait...</h4>' });
})
})
</script>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With