2
I want to prevent text formatting from on a website and for that I need to remove all tags (except <br>
) that they had inside a text box, in case someone thinks of pasting some content from some other site.
An example not to get confused:
var text = "<b>Olá</b>, Usuário<br><i>Seja bem vindo</i>!"
removeHTML(text) = "Olá, Usuário<br>Seja bem vindo!"
Thank you! Never would I think of using innerText for this rsrs
– Iago Bruno
Eita, had forgotten the <br/> tag that can be used too, but I think I can change your code.
– Iago Bruno
@Iagobruno edited the answer to be more comprehensive in the tag
<br />
– Sergio