jquery - Invoke download of a tag in html using javascript? -


currently have <a> tag has declared download attribute, this:

<a href="123.png" download >download it!</a> 

which tag above, can download image url when clicking on link. have button on page, :

<button>download using button!</button> 

is there way let user download not clicking on link clicking on button instead.

my purpose making auto code can download image specified class on html page.

using native javascript this:

html:

<a id="download-link" href="123.png" download >download it!</a> 

javascript:

document.getelementbyid("download-link").click(); 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -