Ask coding questions

← Back to all posts
How to stop HTML from working on chat?
A1PHA1 (10)

On OrbitChat, a chat that I've been working on with @Xenity. You can see the code here. Now, the issue that I'm having is that if i type in html, it works.

And yes, I'm planning to get rid of the "undefined" text, ignore that for now.

So, how would I replace the actual HTML with just the text of the code? All answers are appreciated.

Coder100 (18143)

use .innerText instead, so like:

document.getElementById("id").innerText = "";

or textContent

document.getElementById("id").textContent = "";
A1PHA1 (10)

@Coder100 so, I'm not so good at JavaScript, but I know a little. I want it so that their not modified when the're typing, but when they click send.

Xenity (9)

@Coder100 i think what @A1PHA1 means is a way to use the tags, without using the tags. Such as Markdown tags, or shortcuts (ctrl + B, i, etc.)