- Joined
- Jun 13, 2023
- Messages
- 3
- Reaction score
- 0
Hi all,
This is my index.html page code :
And below is my index.js code :
This is my index.html page code :
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>My Website</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Hello</h1>
<input type="checkbox">
<button style=":active color:red;">Click Me</button>
<ul>
<li class="list">
<a href="https://www.google.com">Google</a>
</li>
<li class="list">Second</li>
<li class="list">Third</li>
</ul>
<script src="index.js"></script>
</body>
</html>
And below is my index.js code :
var liWord = document.firstElementChild.lastElementChild.lastElementChild.lastElementChild;
liWord.innerHTML="Parrot";
But when run index.html in browser, nothing happens i.e. I want to replace the last list item name from "Third" to something else for example here "Parrot" but even after refreshing hte browser nothing changes!!
Plz help.. is there anything wrong in the code?