<div class="color">
<p>P element in first div with color. Div's index is 0.</p>
</div>
<script>
var x = document.getElementsByClassName("color");
alert(x[0].innerHTML);
</script>
<p>P element in first div with color. Div's index is 0.</p>
</div>
<script>
var x = document.getElementsByClassName("color");
alert(x[0].innerHTML);
</script>
No comments:
Post a Comment