Hi,

I have a bug with JQuery Autocomplete plugin. I don't know whether
it's a bug or feature by design. The bug is easy to produce on-demand.

Step-by-step to produce a bug.
. Click to add new Author textbox.
. Select second Author textbox to focus.
. Type first two characters, says, 'La'.
. Autocomplete list is popped up on the second textbox as expected.
. Type 'DOWN' key one time.
. It causes to jump to first original Author textbox.
Why? Instead of moving a highlight to second item of autocomplete list
on second textbox.

The code is here:
<html><head>
<link rel="stylesheet" href="autocomplete.css" type="text/css"
media="screen">
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="jquery.autocomplete.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
        $("#author_0").autocomplete( <your url>,{minChars:2,autoFill:true});
        $("#addAuthor").click(function(){
                var oldid=$("#authorDiv input:last").attr("id");
                var newid="author_"+(parseInt(oldid.substr(12))+1);
                $("#authorDiv div:last").clone(true).insertAfter("#authorDiv
div:last");
                $("#authorDiv input:last")
                        .attr("id",newid)
                        .removeAttr("value");
                $("#"+newid).autocomplete( <your 
url>,{minChars:2,autoFill:true});
        });
});
</script>
</head>
<body>
<h1>AutoComplete Field - Acid Test</h1>
<div id="authorDiv">
        <div>
                <label>Author: </label>
                <input id="author_0" name="author[]" type="text" value="Doe, 
John"/>
        </div>
</div>
<p><input type="button" id="addAuthor" class="formButton" value="Add
Author"/></p>
</body></html>

Any resolution? JQuery autocomplete seems not following current id?

Reply via email to