10 weber Posted June 27, 2010 Share Posted June 27, 2010 After changing an input's value, a function should be triggered:accuracy: <input type="text" value="25" onchange="someFunction()" />pxbut instead, the function takes place after the input was blurred. Link to comment Share on other sites More sharing options...
jeffman Posted June 27, 2010 Share Posted June 27, 2010 I'm not sure if this is a question or not, but I'll comment. The change event for a text element is only fired when the focus moves away from the element and the content has changed. Otherwise, it would fire with every keystroke. Since you can trap keystrokes with keydown and keypress, I guess the designers figured it would be also useful to know when the user has committed himself to a change. So that's the change event. Link to comment Share on other sites More sharing options...
10 weber Posted June 27, 2010 Author Share Posted June 27, 2010 I'm not sure if this is a question or not, but I'll comment. The change event for a text element is only fired when the focus moves away from the element and the content has changed. Otherwise, it would fire with every keystroke. Since you can trap keystrokes with keydown and keypress, I guess the designers figured it would be also useful to know when the user has committed himself to a change. So that's the change event.An embarrassing mistake... Thanks! Link to comment Share on other sites More sharing options...
jeffman Posted June 27, 2010 Share Posted June 27, 2010 Not embarrassing. I suspect most of us have pondered this particular issue at one time or another. It's not exactly intuitive. Link to comment Share on other sites More sharing options...
wirehopper Posted June 27, 2010 Share Posted June 27, 2010 If the input is changed, then the original value was restored, onchange doesn't fire, but onblur would. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.