Answers for "javascript change a href"

4

change href for a tag using JS

document.getElementById("myAnchor").href = "http://www.cnn.com/";
Posted by: Guest on April-02-2021
8

javascript set attribute href

var a = document.getElementById('myElementID');
    a.href = "http://www.mywebsite.com";
Posted by: Guest on December-04-2019

Code answers related to "Javascript"

Browse Popular Code Answers by Language