I searched a lot but couldn't find a solution I thank anyone who can help me.
I want to download files on button click but based on values in the text of buttons.
I have three buttons in my HTML like this
<input type="button" onclick="myFunction(this, name1.mp3)" value="button1.mp3"> <input type="button" onclick="myFunction(this, name2.mp3)" value="button2.mp3"> <input type="button" onclick="myFunction(this, name3.mp3)" value="button3.mp3"> my JavaScript is
function myFunction(elmnt, name) { var url = "http://mysite*com/" + elmnt.value; var downloadFileWithThisName = name; ---my download code--- } How can I download my url with the name I passed to function?
what should I write for ---my download code--- part?
Thank you in advance.