+ 1
If I give my function a name, suddenly my code wonât run???
This has happened to me with two other JavaScript apps. I donât understand what is happening, or why.
1 Answer
0
html:
<!DOCTYPE html><html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width" />
<title>k</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>k</h1>
<div id="test"></div>
<script src="script.js"></script>
</body>
</html>
javascript:
addEventListener('load', function(e) {
document.querySelector('#test').innerHTML = 'k';
});
function HelloWorld(){
alert("Hello World!");
};