Select and Modify Elements
Tue Aug 30 2022 00:04:45 GMT+0000 (Coordinated Universal Time)
Saved by
@cruz
#javascript
document.querySelector('h1').innerHTML = 'Most popular Harry Potter characters';
document.getElementById('fourth').innerHTML = 'Professor Snape';
document.getElementsByClassName('slytherin')[0].innerHTML = 'Salazar Slytherin';
document.getElementsByTagName('li')[0].innerHTML = 'Dobby';
<html>
<head>
<title>Popular Fantasy Searches</title>
</head>
<body>
<h1 class="ranking">Top 5 Best Selling Costumes</h1>
<ol>
<li id="first">Harry Potter</li>
<li id="second">Hermione Granger</li>
<li class="slytherin" id="third">Lord Voldemort</li>
<li class="slytherin" id="fourth">Draco Malfoy</li>
<li id="fifth">Hagrid</li>
</ol>
</body>
<script src="./main.js"></script>
</html>
content_copyCOPY
Comments