0

index.html


<!DOCTYPE html>
<html>
<head>
    <title></title>
   
</head>
<body>
   <h1 class="name">bbb</h1>


</body>
<script src="app.js"></script>
</html>

app.js

var text = document.getElementsByClassName("name").innerHTML;

alert(text)

The output of the alert function is undefined not sure where iam going wrong here

Rocky
  • 11
  • 5

0 Answers0