Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What events does an <input type="number" /> fire when its value is changed?

Just wondering whether anyone knows what events an HTML5 <input type="number" /> element fires when its up / down arrows are clicked:

example number input

I'm already using an onblur for when the focus leaves the input field.

like image 642
Ian Oxley Avatar asked Oct 15 '10 07:10

Ian Oxley


People also ask

Which event occurs when the value of an element has been changed?

The onchange event occurs when the value of an element has been changed.

Which event is triggered when a form field is changed?

Whenever the value of a form field changes, it fires a "change" event.


2 Answers

change would be the event that is fired when the field's value changes.

I think the HTML5 event input would also fire.

like image 161
Jacob Relkin Avatar answered Sep 22 '22 22:09

Jacob Relkin


I found that for jQuery the following code covered keyboard input, mousewheel changes and button clicks in Chrome, and also handled keyboard input in Firefox

$("input[type=number]").bind('keyup input', function(){     // handle event }); 
like image 32
Will Moore Avatar answered Sep 24 '22 22:09

Will Moore