Adding 'download' attribute to <a> dynamically using Jquery
<p>I am trying to add the download attribute to an  tag dynamically. Here is what I have so far:</p>

<pre><code>$(fclass).append('&lt;a href="/files/'+$days[$i][2][1]+'" download&gt;'+$days[$i][2][0]+'&lt;/a&gt;');
</code></pre>

<p>Which produces this: </p>

<pre><code>&lt;a href="/files/day0.pdf" download=""&gt;Slideshow (Notes)&lt;/a&gt;
</code></pre>

<p>I also added the exact same tag as this produces into my HTML manually, but instead of</p>

<pre><code>&lt;a href="/files/day0.pdf" download=""&gt;
</code></pre>

<p>I used</p>

<pre><code>&lt;a href="/files/day0.pdf" download&gt;
</code></pre>

<p>The manual version works perfectly, and automatically downloads the file, however, the dynamically placed version does not.
I have also tried this:</p>

<pre><code>$(a).attr("download","/files/day0.pdf");
</code></pre>

<p>But this does not seem to work. Any ideas on how to fix this? Thank you very much.</p>