Changing the
href
,
text
of a link JS
//calling the function in window.onload to make sure the HTML is loaded
window.onload = function() {
    var el = document.getElementsByTagName('a');
    el[0].href= 'http://www.sololearn.com';
};
HTML
<a href="http://www.example.com">Some link</a>
<br />
<a href="https://google.com">Google.com</a>
by Valeri Tandilashvili
4 years ago
JavaScript
DOM
2
Pro tip: use ```triple backticks around text``` to write in code fences