Adding the 'download' attribute to <a> dynamically with jQuery
I am trying to add a loading attribute to a tag dynamically. Here is what I still have:
$(fclass).append('<a href="/files/'+$days[$i][2][1]+'" download>'+$days[$i][2][0]+'</a>'); What produces this:
<a href="/files/day0.pdf" download="">Slideshow (Notes)</a> I also added the same tags as in my HTML, but instead
<a href="/files/day0.pdf" download=""> I used
<a href="/files/day0.pdf" download> The manual version works fine and automatically downloads the file, however the dynamically placed version does not work. I also tried this:
$(a).attr("download","/files/day0.pdf"); But this does not seem to work. Any ideas how to fix this? Thank you very much.
+5