JSFiddle - React, Tailwind, and code Playground
HTML
<input id="id_sq_pl" name="sq_pl" value="" type="number" />
CSS
5. -> 5
.5 -> 0.5
5.568 -> 5.6
as -> alert
empty -> will be ok
spacebar -> empty, will be ok
JavaScript
$(window).load(function(){
$('#id_sq_pl').blur( function(){
var val = $(this).val();
if(!val.length) return false;
val = +val.replace(',','.');
if(!val) {$(this).val('');alert('Введите правильное число'); return false};
val = Math.round( val * 10 ) / 10;
$(this).val((''+val).replace('.',','))
console.log(val);
});
});