javascript modify href attr 1

javascript modify href attr

var a = document.getElementById('myElementID');
    a.href = "http://www.mywebsite.com";

Here is what the above code is Doing:
1. We’re getting the element with the ID of myElementID.
2. We’re setting the href attribute of that element to http://www.mywebsite.com.

Similar Posts