I am using jQuery autocomplete and would like to limit the showing results only when the user types at least 2 characters. How to do that?
for the record:
The minimum number of characters a user has to type before the Autocomplete activates. Zero is useful for local data with just a few items. Should be increased when there are a lot of items, where a single character would match a few thousand items.
Code examples
Initialize a autocomplete with the minLength option specified.
$( ".selector" ).autocomplete({ minLength: 0 });
Get or set the minLength option, after init.
//getter
var minLength = $( ".selector" ).autocomplete( "option", "minLength" );
//setter
$( ".selector" ).autocomplete( "option", "minLength", 0 );
minLengthIntegerDefault:1
docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With