这是我的 HTML 代码
<!DOCTYPE html>
<html>
<head>
<script src="JS/SignUp.js"></script>
</head>
<body>
<div class="container">
<div class="subContainer">
</div>
</div>
</body>
</html>
这是我的 JavaScript 代码
var x = document.getElementsByClassName("subContainer");
x[0].innerHTML = "Hello World!";
但我收到错误
Uncaught TypeError: Cannot set property 'innerHTML' of undefined