I would recommend that instead of overriding you watch the change event and then do whatever you want.
That being said, there are two ways in which you can override that behavior. Suppose the following html
<input id="num" type="number" value="0" step="1" min="0" max="100"/>
Let's get a reference to the number input:
// Access the spinner
var spinner = document.getElementById("num");
Now if you want to override ALL stepUp()
functions, you can use the HTMLInputElement
Object:
// Override all spinner's setup functions
HTMLInputElement.prototype.stepUp = function(num){
console.log('All overridden: Stepping up '+num);
};
Although you can also override only that input's stepUp()
function:
// Override only that spinner's stepUp function
spinner.stepUp = function(num){
console.log('Stepping up '+num);
};
To see an example of this in action open this jsFiddle.