title: Create a variable using document.createElement('a') and apply click on it without appending it to DOM
body: <p>I am creating an anchor element using jQuery/Javascript. I am using this method:</p>
  
  <pre><code>var a = document.createElement('a');
  a.href = '/files/target.pdf';
  a.download = true;
  </code></pre>
  
  <p>But how can I perform a <strong>click</strong> event on it <strong>without appending/prepending it to the DOM</strong>? My intention is pretty simple. I want to let the user download a file instead of opening it in browser and that's why I want to avoid the <code>window.location = '/files/target.pdf';</code> function.</p>
  
  <p>Please help me.</p>
  
  <p>Thanks.</p>