JSFiddle - React, Tailwind, and code Playground
HTML
<div><span>Search: </span><input type="text" name="search" size="75" /></div>
CSS
div {
height: 50px;
background-color: #CCC;
}
JavaScript
$("[name='search']").on({
keydown: function(e) {
if (e.which === 32 || e.which === 220) {
e.preventDefault();
var v = this.value,
s = this.selectionStart;
this.value = v.substr(0, s) + '' + v.substr(s, v.length);
}
if (e.which === 55) {
e.preventDefault();
var v = this.value,
s = this.selectionStart;
this.value = v.substr(0, s) + '7' + v.substr(s, v.length);
}
},
paste: function(e) {
var s = this;
setTimeout(function() {
// here i no sure how to do it
});
}
});