How to use the 'scroll' and 'max' options in Autocomplete
Asked Answered
C

1

33

I need help with aucomplete of the jquery.

jQuery("#PeopleName").autocomplete(
                                   {source:["name1","name2","..."],
                                    minLength:2,
                                    max:10,
                                    scroll:true});

The 'scroll' and 'max' are not working.
I am use jquery-ui-1.8.18.custom.min.js. What is wrong with this code?

Changteh answered 6/3, 2012 at 19:16 Comment(7)
Are you getting any errors in your console?Celebrate
Is this the jQuery-ui auto complete or some other auto complete?Himeji
The autocomplete working but the scroll and max not working.Changteh
jquery-ui-1.8.18.custom.min.jsChangteh
Have a look at documentation. I do not see any scroll and max properties documented in options, events or methods.Himeji
Look at this site: exampleChangteh
The first answer on this question probably refers to an old version of jQuery UI. I think the two options you mentioned are not present in latest version. You might get luck with an older version. Or... if you can edit you question and tell exactly what you want, perhaps someone can post code (or hack) that works in current version.Himeji
C
109

I managed to solve this problem. I found the code in jqueryUI

<style>
       .ui-autocomplete {
            max-height: 200px;
            overflow-y: auto;
            /* prevent horizontal scrollbar */
            overflow-x: hidden;
            /* add padding to account for vertical scrollbar */
            padding-right: 20px;
        } 
</style>

<script>
jQuery("#PeopleName").autocomplete({
                                   source:["name1","name2","..."],
                                   minLength:2
                                   });

</script>

This is working.

Changteh answered 8/3, 2012 at 13:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.