JSFiddle - React, Tailwind, and code Playground
by Dedi Wibisono
HTML
<input class="dedi" type="text" placeholder="test" />
<div></div>
CSS
.dedi {
text-transform: uppercase;
}
::-webkit-input-placeholder { /* WebKit browsers */
text-transform: none;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
text-transform: none;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
text-transform: none;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
text-transform: none;
}
JavaScript
$(".dedi").on("keyup", function() {
if (/\s+/g.test(this.value)) {
this.value = this.value.replace(/\s+/g, "")
}
});