I have a hidden icon on my page that has an href attribute that calls an Umbraco surface controller
<a class="fas fa-file-pdf" id="download-pdf-icon" aria-label="Download PDF" href="/umbraco/Surface/BenefitStatementPdfSurface/BenefitStatementPdf?memberNumber=23123080&selectedYear=2017&pageId=1505">
<span class="visually-hidden">Download PDF</span>
</a>
I have a button that triggers the click event of the icon to download the PDF returned by the surface controller
I would like to amend the label of the button to a spinner whilst waiting for the PDF to download and then reset the label once completed but there does not seem to be a way to do this as there is no event to liste/wait for for completion
Ideally, something like this would work
$(".download-pdf-button").on("click tap touchstart", function () {
$(this).text("Waiting...");
$("#download-pdf-icon")[0].click();
$(this).text("Completed");
});
Is there no event I can listen for or callback I can set?