Hi all,
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="Priyanka";
But when I run index.html in browser, nothing happens i.e. here I wanted to replace the last list item name from “Third” to something else for example my name “Priyanka” but even after refreshing the browser nothing changes!!
Plz help… is there anything wrong in the code?