diff --git a/index.html b/index.html index 9feb1d8..f3e684e 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,7 @@ $(function () { // Create socket var socket = io(); + const date = new Date(); // Wait for server response and identify client socket.on('user_identify', function(){ @@ -28,32 +29,58 @@ // Receive messages from server socket.on('message_receive', function(msg){ - $('.message_container').append($('').html(msg.username + ': ' + msg.message)); - $('.message_container').append($('')); + document.getElementById('message_container').innerHTML += + ` + + + ${msg.username} + ${date.getHours() + ':' + date.getMinutes()} + ${msg.message} + + `; }); }); - +