+ 2

Error in js code

https://code.sololearn.com/W0yvk4bJgvMs/?ref=app Can anyone correct my JS code. I want to change href link but it's not working

24th Dec 2018, 10:05 PM
Vinod Krishna
Vinod Krishna - avatar
2 odpowiedzi
+ 4
You're making it way too difficult. var el = document.getElementById('demo').getElementsByTagName("a"); el[0].href='https://www.sololearn.com';
24th Dec 2018, 10:18 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
Thank you very much. I made it that way to practice using 'childNodes'. With ur answer i learned new method.:)
24th Dec 2018, 10:58 PM
Vinod Krishna
Vinod Krishna - avatar