JSFiddle - React, Tailwind, and code Playground
by shunovi
HTML
<script>
function limitInput( k, obj ) {
switch( k ){
case 'ru':
obj.value = obj.value.replace(/[^а-яА-ЯёЁ0-9 -]/ig,'');
break;
case 'en':
obj.value = obj.value.replace(/[^a-zA-Z0-9 -]/ig,'');
break;
}
}
</script>
<input onkeyup="limitInput( 'ru', this );" placeholder="Введите текст на кириллице"/>
<input onkeyup="limitInput( 'en', this );" placeholder="Введите текст на латинице"/>