Answers for "javascript anchor tag"

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
3

a tag

<a href="https://www.google.com">Visit google.com!</a>
Posted by: Guest on June-30-2020

Browse Popular Code Answers by Language