js change href code example
Example 1: change href for a tag using JS
document.getElementById("myAnchor").href = "http://www.cnn.com/";
Example 2: javascript set attribute href
var a = document.getElementById('myElementID');
a.href = "http://www.mywebsite.com";
Example 3: javascript modify href attr
link.href = link.href + '?param1=' + input.value;