JSFiddle - React, Tailwind, and code Playground
by wangtn18
HTML
<!--
Tìm hiểu các method của document:
- getElementsByClassName
- getElementsByTagName
- querySelector
- querySelectorAll
-->
<!DOCTYPE html>
<html>
<body>
<div class="example">First div element with class="example".</div>
<div class="example">Second div element with class="example".</div>
<p>Click the button to change the text of the first div element with class="example" (index 0).</p>
<button onclick="myFunction()">Try it</button>
<!-- <script>
function myFunction() {
var x = document.getElementsByClassName("example");
x[0].innerHTML = "Hello World!";
}
</script> -->
</body>
</html>