Hi,
I have a function (filterLeads) that I wish to call both when a form field is moved away from (blur) and when the enter key is pressed within a form field.
$('#filter input, #filter select').blur(filterLeads);
$('#filter input, #filter select').keypress(function(e){if(e.which == 13) {filterLeads();}});
The blur works correctly but I am having a problem with the keypress event. The event does not appear to be fired unless something comes before the call to filterLeads(); for example:
$('#filter input, #filter select').keypress(function(e){if(e.which == 13) {alert(e.which);filterLeads();}});
This correctly calls filterLeads() after acknowledging the alert (which shows the correct key code).
Any ideas? (Browser FF 3.0)