how to appen to link in js code example
Example 1: create a link javascript
<html>
<head></head>
<body>
<script>
var a = document.createElement('a');
var linkText = document.createTextNode("my title text");
a.appendChild(linkText);
a.title = "my title text";
a.href = "http://example.com";
document.body.appendChild(a);
</script>
</body>
</html>
Example 2: create link and click javascript
const link = document.createElement('a');
link.id = 'someLink';
link.href = 'https://example.com';
document.getElementById('someLink').click();