I am struggling to create a validation that prevents users from inputting numeric values into a textbox. I have tried using a native JavaScript solution, but it does not seem to be working on my end.
In my textbox, I have set up this trigger
v-on:keyup="preventNumericInput($event)">
Within my Vue component, I have created a function in the following manner:
preventNumericInput($event) {
console.log($event.keyCode); //displays the keyCode value
console.log($event.key); //shows the key value
var keyCode = ($event.keyCode ? $event.keyCode : $event.which);
if (keyCode > 47 && keyCode < 58) {
$event.preventDefault();
}
}
Could someone please assist me with this issue?