Shafizadeh Shafizadeh - 1 year ago 46
CSS Question

Is it possible to limit the number of autocomplete-box rows?

As you know,

attribute is used for
s by default. Something like this:

enter image description here

Ok, I can totally remove that attribute by setting it

<input type="email" name="email" autocomplete="off">
// ^^^^^^^^^^^^^^^^^^

But I don't want disable it completely. I just want to limit it to two rows. Currently it is six rows. Anyway, Is there any solution (even by JS) to limit the number of that box's rows?

Answer Source

You can specify array of autocomplete options using jQuery.

    source: function(request, response){
        var results = $.ui.autocomplete.filter(yourAutocompleteArray, request.term);
        response(results.slice(0, NUMBER_OF_ROWS_YOU_WANT));