Ganeshji Marwaha wrote:
klaus, how did u use timeout to prevent IE or Opera from firing change events...

Or, did u mean that, to achieve cross-browser consistency, u didn't listen for change events, rather chose to poll the select on an interval?


I'm simply delaying the handler being executed via setTimeout to prevent the event handler fired too early if a user navigates quickly through the select with the keyboard. In my case I needed to submit the form, which is of course critical:

var change;
$('select').bind('change', function() {
    var form = this.form, submit = function() { form.submit(); };
    if ($.browser.msie || $.browser.opera) {
        clearTimeout(change);
        change = setTimeout(submit, 400);
    } else {
        submit();
    }
});


I'd say that is still not 100% bulletproof, but it works...


--Klaus

Reply via email to