Only autocomplete with a minimum of three characters

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Only autocomplete with a minimum of three characters

This topic contains 2 replies, has 2 voices, and was last updated by mokelage51 mokelage51 2 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28409
    mokelage51
    mokelage51
    Participant

    Hi there!

    Is there an option to define a minimal character count for the autocomplete feature? So you’d need to enter at least three characters before your word gets autocompleted.

    If there is no such option, do you plan on adding it? Otherwise can you tell me where to look for individually implementing this feature?

    Best,
    Marc

    #28421
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Marc,

    There is no option for that unfortunately, we are not currently planning to add it either. Usually I recommend a custom code if possible, but there is no hook at the script location to add a bypass solution to this. The only way is to change the core files.

    The autocomplete handler function is located in the wp-content\plugins\ajax-search-pro\js\nomin\jquery.ajaxsearchpro.js file, on lines 2320-2351.
    You could add something like this:

    if ( $this.n.text.val().length < 3 ) return;

    ..before this line (2334):

    var data = {

    The javascript loading method has to be changed to Non minified for changes to populate, otherwise the minified file is loaded.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #28748
    mokelage51
    mokelage51
    Participant

    Thank you very much, it works like a charm.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.