"io is not defiend" io.connect Socket.io Nodejs


I was working on socket.io and started with working on a chat services.
Everything worked fine on the server side but upon trying to connect to
the /socket.io/socket.io.js on the client side by using var socket = io.connect();
it says that “io is not defined; please fix or add /global io/”.

<!doctype html>
    <div id="chat"></div>
    <form id="send-message">
        <input size="35" id="message"></input> 
        <input type="submit"></input>
    <script src="/socket.io/socket.io.js"></script>
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
        jQuery(function ($) {
            var socket = io.connect();             <----"io is not defined; please fix or add /*global io*/"
            var $messageForm = $('#send-message');
            var $messageBox = $('#message');
            var $chat = $('#chat');

            $messageForm.submit(function (e) {
                socket.emit('send message', $messageBox.val());
            socket.on('new message', function (data) {
                $chat.append(data + "<br/>");