Don't allow typing numbers between max and min value
问题 I'm working on an Angular 4 project. I have an HTML <input type="number"> with min max and step attributes. My goal is to prevent typing numbers beyond the min-max range that is user friendly. How can I do that? function myFunction(e) { var min = -100; var max = 100; var txtValue = document.getElementById("txt").value; var pressedValue = e.key; var combined = parseFloat(txtValue, pressedValue); console.log(`OLD:${txtValue}\nNEW:${pressedValue}\nCOMBINED:${combined}`); if (combined > max) { e