views:

42

answers:

3

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

alt text

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

+2  A: 

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

I think the HTML5 event oninput would also fire.

Jacob Relkin
only `oninput` is fired when 'up' and 'down' arrows are clicked.
N 1.1
but onchange only fires on blur, atleast in firefox. I guess we will have to look for key press.
andho
onchange and oninput both worked in Opera, but only oninput would work in Chrome (and only then when I returned false from the event-handler - otherwise Chrome would repeatedly fire the oninput event)
Ian Oxley
@N 1.1: `oninput` IS fired when a character is insert into the field
andho
+1  A: 

You have the list of new Javascript events for HTML 5 here. In your case, I think the onchange event will be fired.

romaintaz
A: 

The onchange event fires on blur but the oninput event fires as you type. Maybe you might want to put a timer on the oninput event and fire your onchange event when the user has stopped typing for a second?

andho