Unexpected token


#1

I am getting an Uncaught SyntaxError: Unexpected token < in my first line.

I have double checked and I can't see what the Syntax error is. Anyone see something in this code?

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>

	var counter = 0;
	$("#number").text(counter);
	function count(){
		counter = counter +1;
		$("#number").text(counter);
	}

#2

Where does this code belong to?


#3

Good question. This code is in my.js and it is part of quiz.html that has this code. Sorry I am such an idiot newb.

<html>
	<head>
		<title>Quiz</title>
		<script src="my.js"></script>
		<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
		
		<link rel="stylesheet"
			type="text/css"
			href="bootstrap.css"
			/>
	</head>
	<body>
		<a
		href="funny_family.html">
			Funny Family 
		</a>
		 &nbsp;
		<a
		href="quiz.html">
			Quiz
		</a>
		 &nbsp;
		
		<hr></hr>

		<h1>Click the one that should not appear on this list.</h1>

		<h3>
		The top 5 funny things Lucas and Sophia do.
		</h3>

		<ol>
			<li onclick="alert('wrong try again');"> Chase each other naked around the house</li>
			<li onclick="alert('wrong try again');"> Whisper a secret everyone can hear</li>
			<li onclick="alert('wrong try again');"> Ask me to feel their belly to see if it is full while eating dinner</li>
			<li onclick="alert('wrong try again');"> Use the hop-pity hop to go around inside the house</li>
			<li onclick="alert('wrong try again');"> Dance wildly around to fast music </li>
			<li onclick="alert('Correct, you are exceptionally bright and were probably a child who did not do what they were told at some point in your life.');"> Do what they are told</li>
		</ol>

		<p id="number" onclick="count();"></p> 	

	</body>
</html>

#4

then you probably don't need the:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
But it would probably be easier if you could make make a fiddle here:
https://jsfiddle.net/

Also does this belong to an exercise? I'll move it to the jQuery category or do you have a better idea? (As this is the beginner section for javaScript)


#5

@splatakus,
Have you tried starting the HTML-Document with

<!DOCTYPE html>

or
if your Browser supports it

<!DOCTYPE html5>

#6

When I comment out then I get a Reference error that $ is not defined.

Thanks for your response.


#7

I tried that but did not have an effect. Still getting the same error.

Uncaught SyntaxError: Unexpected token in my first line.