JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" class="digs" maxlength="5"><strong class="err" style="display: none;"></strong>
CSS
strong {
display: none;
background-color: #E1E4F2;
color: #F00;
border: 1px solid #000;
border-radius: 5px;
position: absolute;
left: 40%;
padding: 5px;
box-shadow: 0px 0px 10px #6E6E80;
z-index: 1;
}
JavaScript
$(document).ready(function(){
$('input[class=digs]').keypress(function(e){
if(e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)){
$(this).next().html("Sadece rakam").show().fadeOut(3000);
return false;
}
});
//$('input[class=digs]:first').focus();
});