jQueryAutocompletePlugin
jQueryAutocompletePlugin copied to clipboard
IE 9 probelm with click event in dropdown for multiselect
In Firfox the plugin is working like a charm. In IE 9 when clicking in the dropdown for selecting an item is just working correct the first time in a multiselect. When selecting the second (or further) item for multiselect a problem arrises: The current (first selected) value is overridden and the letters typed in are joined.
Example:
- Typing e.g. "sc" into the input, the dropdown appears, click with mouse on "Scott Tiger". "Scott Tiger; " is copied into the item and the letters "sc" are cleared from the item. Everything is fine in IE 9 and firefox.
- Typing e.g. "jo" into the input, the dropdown appears, click with mouse on "John Dow". Firefox is fine, the value "John Dow; " is copied into the item and the lettes "jo" are cleared. The item now holds the values "Scott Tiger; John Dow; "
Problem in IE 9: The item holds the wrong value "John Dow; jo"
IE 9 overrides the already selected values of the multiselect and does not clear the typed in letters for selection.
Thx a lot for some hints.
<html>
<head>
<script type='text/javascript' src='lib/jQuery-1.4.4.min.js'></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css">
<script type="text/javascript">
$().ready(function() {
$('#ac').autocomplete(['Scott Tiger', 'John Dow'], {multiple: true, multipleSeparator: '; '});
});
</script>
</head>
<body>
<form>
<input id='ac'>
</form>
<body>
</html>
You may try it here: http://jsfiddle.net/t7xeY/
see http://jsfiddle.net/t7xeY/20/ 我加了下面的一行代码在828行 https://github.com/agarzola/jQueryAutocompletePlugin/blob/master/jquery.autocomplete.js#L828
now work well in ie9. 有一个问题,在选第一个词时,用鼠标点击是好的,按回车键则光标会跳到最前面,在选第二个词以后,没有这样的问题。