JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
$(document).ready(function () {
$('input').keyup(function () {
var $th = $(this);
$th.val($th.val().replace(/[-]/g, function (str) {
//alert('You typed " ' + str + ' ".\n\nPlease use only letters and numbers.');
return '';
}));
$('input')[0].setSelectionRange(0, 0)
});
});