I have over 100 articles. Each article has a different PDF file attached. There's a form where a user must filled and gets redirected to a thank you page. The code is below.
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'https://example.com/thankyou';
}, false );
In the above code, I would like to add the code below so that it triggers the download. How can I combine this two codes?
$(document).ready(function(){
$("#download a").trigger("click");
});
The article in HTML format:
<p>Content goes here</p>
<p id="download"><a href="https://example.com/path/file.pdf">Download</a></p>
If there's a better way, please suggest.