I recently made a chat on my website, it works pretty good but i just found out that i can send elements there, like divs, anchors etc, how can i make it plain text?
thats how the code looks like
let msgDiv = '<div id="receivedMsgDiv">\n' +
'<div id="rMsgName" class="messageName">\n' +
''+data.val().name+'' +
'</div>\n' +
'<div id="receivedMsg" class="bounce">\n' +
''+data.val().message+'' +
'</div>\n' +
'<div id="rMsgTime">\n' +
''+data.val().time+'' +
'</div>\n' +
'</div>';
let msg = document.getElementById("msgDiv");
msg.innerHTML += msgDiv;
i want a message to be a plain text so i can send eg "Hey friend i found the solution its: <div id="id">something</div>
instead of "Hey friend i found the solution, its: an element any ideas how to fix that?