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++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -