<!DOCTYPE html>
<html>
<body>
<ul>
<li>Lion</li>
<li>Tiger</li>
</ul>
<p>Click the button to change the value.</p>
<button onclick="myFun()">Try
it</button>
<script>
function myFun() {
var Items =
document.getElementsByTagName("UL")[0];
Items.getElementsByTagName("LI")[0].innerHTML =
"Water";
}
</script>
</body>
</html>
Output:
- Water
- Tiger
No comments:
Post a Comment