开发者

jquery autocomplete not working for terms with more than two words

开发者 https://www.devze.com 2023-02-24 06:23 出处:网络
I\'m using Jquery Autocomplete hooked up to googles autocomplete terms. It works great when I ty开发者_StackOverflowpe the first word but fails to perform any further queries

I'm using Jquery Autocomplete hooked up to googles autocomplete terms. It works great when I ty开发者_StackOverflowpe the first word but fails to perform any further queries after the space bar is hit.

I've scoured over the code to figure out why this is and just don't get it. I've tried using the multiple and multipleSeperator settings but they don't help.

Does anyone know why this isn't working?

The code can be downloaded here : http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

Thanks.


I'm pretty sure this is related to spaces being interpreted as their url-encoded equivalents. I ran into this problem a while back - I have since switched to jQuery UI autocomplete, which I think has a better API. Anyway, (I think) you will need to replace spaces with pluses, along the lines of:

$('#search').val($('#search').val().replace(/\s/g, "+"));

If you post your implementation it will be easier to understand the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消