Hi guys I'm wondering why the $ sign needs to be before the function for the proram to work. I console.log($) and as I thought it is the jQuery selector object. But don't understand why it needs to be there. Please help!!
$(function(){
console.log($, 'testing')
// when the client clicks SEND
$('#datasend').click( function() {
var message = $('#data').val();
$('#data').val('');
// tell server to execute 'sendchat' and send along one parameter
socket.emit('sendchat', message);
});
// when the client hits ENTER on their keyboard
$('#data').keypress(function(e) {
if(e.which == 13) {
$(this).blur();
$('#datasend').focus().click();
}
});
});