JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="text" value="some < nasty > html" />
</form>
<form>
<input type="text" value="some < nasty > html" />
</form>
JavaScript
$('form :input').val(function() {
return this.value
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
});