title: setAttribute download for anchor tag using JavaScript
body: <p>I want to use Javascript to make an anchor tag inside a button, so that, when I click this button, it will download a specified file I set before. But I don't know how to add attribute "download" when using Javascript create it.</p>
  
  <pre><code>function myFunction() {
      var mydiv = document.getElementById("myDiv");
      var aTag = document.createElement('a');
      aTag.setAttribute('href',"abc.com/example.exe");
      aTag.innerHTML = "&lt;button&gt;GO&lt;/button&gt;";
      mydiv.appendChild(aTag);
  }
  </code></pre>