function disableDownloadReportLink(link) {
link.onclick = function(event) {
event.preventDefault();
}
}
function enableDownloadReportLink(link) {
link.onclick = undefined;
}
var el = document.getElementById("wop");
disableDownloadReportLink(el);
setTimeout(
function() {
enableDownloadReportLink(el);
},
4000
);
<a id="wop" href="http://www.google.com">I will work after 4 seconds!</a>
Basically what you have done with disableDownloadReportLink is to disable what the onclick event does. What you can do if you want the link to work normally again is to set onclick to undefined:
function enableDownloadReportLink(link) {
link.onclick = undefined;
}
You can put the call to enableDownloadReportLink into a setTimeout in order to do it after 4 seconds:
setTimeout(
function() {
enableDownloadReportLink(link);
},
4000
);
For your question about how to call those functions, this is what I would do, as I told you in my comment (don't expect this snippet to work, is only an example):
function doEverything(link) {
// submit integration report
document.getElementById('viewIntegrationReport').submit();
// disable link
disableDownloadReportLink(link);
// enable link after 4 seconds
setTimeout(
function() {
enableDownloadReportLink(link);
},
4000
);
}
<a href="#x" id="downloadReportLink" title="This function will provide you a 30 day download of all your eSign transactions." onclick="doEverything(this);"><span>Export E-Sign Information</span></a>
hrefattributeelement.href.disabled, that property doesn't exist ?