JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<input type="text" name="type text"id="text-box"
onkey-press="deep()">
</div>
JavaScript
$(function deep(){
$("#text-box").keyup(function()
{ console.log('hi');
var yourInput = $(this).val();
re = /[`~!#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/\^a-zA-Z0-9]/gi;
var isSplChar = re.test(yourInput);
if(isSplChar)
{
var no_spl_char = yourInput.replace(/[`~!#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/\^a-zA-Z0-9 ]/gi, '');
$(this).val(no_spl_char);
}
});
});