Search code examples
jqueryselectdrop-down-menulivequeryarrow-keys

why doesn't the jquery change event fire when i use the up or down arrows on a select?


I am listening to the change event of a select dropdown using jquery and the livequery plugin.

$(".myDropdown").livequery("change", function () {
});

one thing i noticed (i am using firefox) is that

The event handler doesn't fire from hitting the up and down arrows when i have the select focused (the up and down arrow DO change the entries)

Why doesn't the change event fire when i move the arrows key up and down and is there a recommendation or workaround for this?


Solution

  • If what Malvolio says is true, then that should work

    $(".myDropdown").livequery("change", function () {
       // your event handler
    }).livequery("keypress", function() { 
       $(this).trigger("change");
    });
    

    http://jsfiddle.net/tW6Su/2/ as proof