I'm doing the project for school, I'm 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 .append()
method is vulnerable, why lets inject javascript and even html.
I already tried the .text()
method, but the messages appear one on top of the other.