I have Input type number, and when I write 123- I get an empty value from event.target.value, but I want get value as I write in the input and replace the value with regex /(^([^-\d]*)|[^\d]*)/g for empty value. It is possible to do it? How to get an exactly the same text from input?
It must be a type number because sometimes I need to use min and max attributes.
I want replace text via regex like this (value.replace(regex, ''):
-123.123into-123123---123-456into-123456123-45into1234512e23,.-into1223
const myFun = (e) =>
setTimeout(()=>{
console.log(e.target.value)}
)
<input onkeydown="myFun(event)" type="number"/>
originally i use angular 8 and host listener
@HostListener('input', ['$event']) // or/and keydown
onInputChange(event: Event): void {...}