+ 2

Can i use document.getElementById() in changing href link ?

<a id="max" href="https://sololearn.com">link</a>

2nd Jan 2018, 10:54 AM
Maxphelon
Maxphelon - avatar
5 Answers
+ 3
var elem = document.getElementById("max"); elem.setAttribute('href', 'https://new-href');
2nd Jan 2018, 11:39 AM
ŠØыряŠ¹ Š‘Š°ŃŠ½
ŠØыряŠ¹ Š‘Š°ŃŠ½ - avatar
2nd Jan 2018, 2:17 PM
CalviÕ²
CalviÕ² - avatar
+ 2
yes of course
3rd Jan 2018, 6:24 AM
Nyoma
+ 1
thanks
2nd Jan 2018, 11:04 AM
Maxphelon
Maxphelon - avatar
+ 1
thanks
3rd Jan 2018, 7:13 PM
Maxphelon
Maxphelon - avatar