am trying to allow text field to be entered only decimal and number values as follow

below are valid

```
 .099
  .8
  10
  99.9
  2.9
  4.88
  0.0

```

invalid

```
abc
ac$%$
asdf90
09.89abg#$#
-903abe
+8938/.99
....90.97

```

everything is fine so far. but i want to highlight the text field border the moment if user give only decimal point or more than one decimal point without numbers. the highlight should get removed when he gives valid input.

how to make it very simple the below code.

```
<input type = "text" maxlength = 4, value ="0.0", min=0 max=100/>

$(key).bind("#txtOne", function(obj){ // but i dont know why this Jquery allow character be entered sometimes
    let numberOnly=/^[0-9]+\\.?[0-9]*$/;                    
    if (!numberOnly) {
        return obj.preventDefault();
    }else{
        return true;
    }
}); 

$("#txtOne").on("keypress keyup blur", function(event) {    //after including this, working as expect 
  $(this).val($(this).val().replace(/[^0-9\.]/g, ''));
  if ((event.which != 46 || $(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {
    event.preventDefault();
  }
});

```

help would be much appreicated. thanks in advance

if possible please give me some fiddle example