It is necessary to replace the link "sates0.html" with "index.html" but first you need to find it through id and tag (a).
How to do it?
It is necessary to replace the link "sates0.html" with "index.html" but first you need to find it through id and tag (a).
How to do it?
document.getElementById("foto").querySelector("a").setAttribute("href", "something2.html"); <div id="foto"> <a href="something.html">Link</a> </div> What is your first answer did not fit? Here is a slightly shorter option and with the links that you have.
document.querySelector('#foto a').href = 'index.html' <div id="foto"> <a href="sates0.html">Link</a> </div> Source: https://ru.stackoverflow.com/questions/870500/
All Articles