JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id ="txtClient" value="aaaa" />

JavaScript

$('[id$=txtClient]').keyup(function (e) {
    //if is not a left or right arrow key
		if(e.which != 37 && e.which != 39){  
            var $el = $('[id$=txtClient]'); // the text element to seach for forbidden characters.
            var text = $el.val(); // The value of the textbox
            text = text.split("#").join("");//remove occurances of forbidden characters, in this case #
            $el.val(text);//set it back on the element
        }
    });