66
rated 0 times
[
67]
[
1]
/ answers: 1 / hits: 28807
/ 9 Years ago, wed, april 29, 2015, 12:00:00
I am really struggling this. I am wanting to change the src attribute of an img tag and get the error message getElementsByTagName is not a function. The following is my test markup
<html>
<body>
<div class=logo>
<img src=/a.jpg>
</div>
<script>
document.getElementsByClassName('logo').getElementsByTagName('img')[0].src =/b.jpg;
</script>
</body>
</html>
Any advice is appreciated.
More From » html