Why no alert appear in the following HTML?
My HTML
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="a.js"/>
</head>
<body>
</body>
<html>
a.js
alert("hello");
Why no alert appear in the following HTML?
My HTML
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="a.js"/>
</head>
<body>
</body>
<html>
a.js
alert("hello");
You can't have a self closing script tag. Change the script tag to:
<script src="a.js"></script>
A script
tag cannot be self-closing. try this:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="a.js"></script>
</head>
<body>
</body>
</html>