Skip to main content

Search and Top Navigation

#7874 closed bug (notabug)

Opened November 14, 2011 03:17AM UTC

Closed November 14, 2011 03:58AM UTC

onchange doesn't work when using mouse to select an item

Reported by: jamesgu Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:
Description

I add autocomplete on an input field and it has "onchange" event.

When I use arrow key to move to a select item and press "Enter" to select it, the "onchange" event is fired correctly.

When I use mouse to click on an item to select it, the "onchange" event is fired twice before the input value is changed (One of it should be caused by the focus is move out of the input field).

The autocomplete should fire "onchange" event after setting the value on input field but it didn't do it.

Environment, I didn't find the version in drop down list.

jquery-1.4.4.js

jQuery Autocomplete plugin 1.1

IE 8.

Suggestion fix:

jquery.autocomplete.js, line 602. add logic to fire "onchange" event if the value is changed.

}).click(function(event) {

$(target(event)).addClass(CLASSES.ACTIVE);

var beforeValue = input.value;

select();

var afterValue = input.value;

if (beforeValue != afterValue) {

input.fireEvent("onchange");

}

// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus

input.focus();

Attachments (0)
Change History (1)

Changed November 14, 2011 03:58AM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

That's not jQuery UI.