将 焦点 事件与 更改 事件结合起来即可实现所需的目标:
(function () { var previous; $("select").on('focus', function () { // Store the current value on focus and on change previous = this.value; }).change(function() { // Do something with the previous value after the change alert(previous); // Make sure the previous value is updated previous = this.value; });})();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)