1
I am doing the project for the school, I am in the chat part and I have a question. In the part of sending messages in jQuery:
socket.on('newMessage', function(data){
$chat.append(data.nick+' - ' + menssagem+ '<br/>' );
});
But the problem is that the method .append()
is vulnerable because it lets you inject javascript and even html.
I’ve tried the method .text()
, but the messages appear on top of each other.
now, it was almost, but whenever I for example sent 'a' and in the message to guide a 'b' he added an 'a' to the last message
– user43750