Click on a link not yet in DOM
===

I want to generate a link that is clicked right after creating, but nothing happens

Code:

    var link = $("<a></a>");
    link.attr("src", "/dostuff.php");
    link.attr("target", "_blank");
    link.click();

The attributes are set correctly:

    var link = $("<a></a>");
    link.attr("src", "/dostuff.php");
    link.attr("target", "_blank");
    var linkcheck = link.wrap('<p>').parent().html();
    console.log(linkcheck);

This returns: 

    <a src="/dostuff.php" target="_blank"></a> 

No errors