javascript file not working when linked from HTML

You are using jQuery, but it doesn't seem like you have included it. Add this to your HEAD element

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

You need to import jQuery.

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

Actually, i had a problem like this and i tried the code below.

<head>
<meta charset="ISO-8859-1">
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
</head>