+ 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 odpowiedzi
+ 3
var elem = document.getElementById("max"); elem.setAttribute('href', 'https://new-href');
2nd Jan 2018, 11:39 AM
Шыряй Баян
Шыряй Баян - 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