function loading() { if ($("#contact_form")[0].checkValidity()) { document.getElementById("loading_overlay").style.display = "block"; document.getElementById("loading").style.display = "block"; $("#loading_img").show().each(function() { this.offsetHeight; }).prop('src', '//babinironworks.com/style/loading.gif'); $("#loading_overlay").delay(10000).fadeOut(); $("#loading").delay(10000).fadeOut(); } }