The JavaScript code below should display an alert window with the phrase "Hello World!" when the page index.html was loaded, but this does not happen ... Page content loads, but the function does not execute.
var main = function () {
'use strict';
alert("Hello World!");
};
$(document).ready(main);
Could anyone tell me what's wrong with her?
var main = function () {
'use strict';
alert("Hello World!");
};
window.onload = main;
<!DOCTYPE html>
<html>
<head>
<title>A Simple App</title>
<link rel="stylesheet" href="style.css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<header>
</header>
<section class="comment-input">
<p>Add Your Comment:</p>
<input type = "text"><button>+</button>
</section>
<section class="coments">
<p>This is the first comment!</p>
<p>Here's the second one!</p>
<p>And this is one more.</p>
<p>Here is another one.</p>
</section>
<script scr="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script scr="app.js"></script>
</body>
</html>