views:

26

answers:

1

I have to 2 jquery autocomplete fields with same source url which are injected by 2 separate modules.

  • When I type anything in first autocomplete I get result dropdown.

  • Then I type something in second autocomplete I get result.

  • But then if I type in first autocomplete, it does not show results. It makes the request etc, but it does not display result.

Code generated on the page looks like below:

$( '#someid1' ).autocomplete( url, {
    width: 200,
    selectFirst: false,
    minChars:1,
    matchContains: true,
    cacheLength: 1   
});

$( '#someid2' ).autocomplete( url, {
    width: 200,
    selectFirst: false,
    minChars:1,
    matchContains: true,
    cacheLength: 1   
});

Any help / suggestions ?-

A: 

not maybe the answer but did you know you can have the two selector with just one .autocomplete() like this,

$( '#someid1, #someid1' ).autocomplete( url, {
    width: 200,
    selectFirst: false,
    minChars:1,
    matchContains: true,
    cacheLength: 1   
});

just separate it with a comma...

Reigel
Thanks, both the autocompletes are injected by separate code. So can't use above code.
Kurund Jalmi
Okay, so there are many things missing your question that might help us figure out what the problem is...
Reigel
Updated the post I hope now it is more clear.
Kurund Jalmi