Answers for "how to create an anchor tag in javascript"

0

how to create an anchor tag in javascript

//for adding a link through JavaScript 
let anchor=document.createElement("a");
anchor.href="_anylinkthatyouwanttoadd_";
anchor.innerText="Go to the above link";//optional
console.log(anchor)
let to_add=document.getElementById("the-id-of-the-element-where-you-want-to-add")
to_add.appendChild(anchor)
Posted by: Guest on April-21-2021

Code answers related to "how to create an anchor tag in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language