Good morning everyone,
I hope you can help me; I have a problem with the number type inputs. What happens is that I enter the value using the keyboard, but if for some reason my cursor is inside the input and I scroll down with the mouse, the value of the input changes.
How do I disable this option?
Thank you.
Hello Cristian,
This code applies to all the inputs with type “number”
if(document.activeElement.type === "number"){ document.activeElement.blur(); }
Hello Cristian,You can use the following javascript to prevent the wheel on input numbers:
document.addEventListener("wheel", function(event){ if(document.activeElement.type === "number"){ document.activeElement.blur(); }});If you just want some of the inputs to be restricted, you can use the activeElement and the class selector for examplehttps://jsfiddle.net/rakmanyi_peter/tvu1e79m/
Thank you, Carlos. And how do I specify that it applies to all numeric input types within my form?
I am facing the same issue in my application.
How is the above code applied to the application to fix the issue?
Do you add it to the 'Required Scripts' section of the target block / page?