Sparksido Sparksido - 5 months ago 8
jQuery Question

Javascript is not responding

I have an HTML page referencing a jQuery page which just console logs

hello there
, but the code in the jQuery page is not doing anything and I don't know why.

<!DOCTYPE html>
<html>
<head>
<title>{{title}}</title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
{{{body}}}
<p>hello there you idiot</p>
<script type="text/javascript" src="javascripts/jquery/jquery-2.2.4.min.js"></script>
<script type="text/javascript>" src="javascripts/testscript.js"></script>
</body>
</html>


$(function(){
//alert("hello there");
console.log("hello there");
document.write("hello there");
});


Can anyone please tell me why the script is not console loging anything. Thank you

Answer

Probably, because you're including the file wrong way (you have a typo).

The right way should be:

<script type="text/javascript" src="javascripts/testscript.js"></script>

Comments