$(document).ready(function() { debugger; window.location.href = "https://www.workforcerequests.health.nz/"; }); function isApplicationCreated() { let requestContainer = document.getElementById("draftRequest"); var isApplicationCreated = requestContainer.getElementsByClassName("view-grid")[0].getElementsByTagName("tr").length > 1; if (isApplicationCreated) return true; else return false; } function HideAddRequestButton() { if (isApplicationCreated()) { $( "#btnAddRequest" ).parent().hide(); } } // Executes after page finishes loading. window.addEventListener('load', () => { if ( $( "#btnAddRequest" ).length ) { setTimeout(HideAddRequestButton,1000); } });