I am having the following element defined in my code.
<input type="number"
id="phone"
required
data-length="10"
defaultValue={this.state.formValues.phone}
onInput={(e) => {
e.target.value = Math.max(0, parseInt(e.target.value)).toString().slice(0, 10)
}}
/>
The problem here is whenever I press the key 'E, +, -', the complete value in the number field gets clear. So I just wants a solution to stop this field from taking value such as 'E, +, -' and also it should not clear the value when any of the key is pressed.