JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id='noHTML'></textarea>
JavaScript
var ta = document.getElementById('noHTML');
ta.onkeyup = function (e) {
var val = this.value;
// alternate regexp /<[^<>]+>/g
if(val.match(/<(\/)*(p|div|span)\s*(.*)>/g)) { // fill the regex with all html tags
// alert('no html');
// don't want an alert ? you can replace all html expressions
// alternate syntax for all entities
// this.value = val.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
// its long and slow but the choice is yours
this.value = val.replace(/</g, '<').replace(/>/g, '>');
}
}