【发布时间】:2012-09-27 16:29:59
【问题描述】:
我为 mootools 编写了一个小插件,以便将时间选择器附加到输入字段。
它工作得很好,但我注意到在 Chrome 中,当您单击滚动条以浏览选择器列表时,输入会失去焦点。在其他浏览器中,它不会失去焦点。
//the events that close the selector during blur:
el.addEvents({
'focus': function() {
TimePicker.active(el);
},
'blur': function() {
setTimeout( function() {
el.fireEvent('change');
},150);
},
'change': function() {
TimePicker.validateField(el);
TimePicker.inactive(el);
},
'keypress': function(evt) {
if(evt.key == 'enter') {
el.blur();
}
}
});
我应该如何调整我的事件,以便仅使用下拉列表上的滚动条不会模糊我的输入?
【问题讨论】:
标签: javascript google-chrome focus dom-events timepicker