timepicker
timepicker copied to clipboard
change fires twice .. once on enter, and again on blur()
See fiddle here.
The js is simply ...
$('#time').timepicker({
timeFormat: 'h:mm p',
dropdown: false,
change: function(){
$('#result').append('<div>change</div>');
// $(this).blur();
}
});
... and the behavior I want is ...
- Click into the field.
- Type a number, and hit enter.
At this point, I'd like the input to lose focus. But since it doesn't, I click or tab away, only to have change fired once again. Change fires a second time when the input loses focus. That ain't right. And if I uncomment the blur() line, it also fires twice.
Obviously I could add a var already_changed = 0 global variable, but that's just messy. Any tips on accomplishing my goal here?
The change event is also fired at init, which is also not right....