JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="txt" />

JavaScript

$('#txt').keyup(function (e) {
    var text = $(this).val();
    if (text.indexOf("#") > -1) {
        text = text.replace("#", "");
        $(this).val(text);
    }
});