I'm a beginner of Javascript and html. I want to output 10 "Hi" but following code doesn't work. What should I do?
index.html and app.js is in a same folder.
index.html
<html>
<head>
</head>
<body>
<div class = "test"></div>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
app.js
var main = function(){
for(var i = 0; i<10; i++){
var f = document.createElement('p');
f.innerText = "Hi.";
var div = document.getElementByClass('test');
div.appendChild(f);
};
$(document).ready(main);