Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6388655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:18:22+00:00 2026-05-25T03:18:22+00:00

hi i am using ajax autocomplete for jquery plugin http://www.devbridge.com/projects/autocomplete/jquery/ there is a code

  • 0

hi i am using ajax autocomplete for jquery plugin

http://www.devbridge.com/projects/autocomplete/jquery/

there is a code

  function Autocomplete(el, options) {
    this.el = $(el);
    this.id = options.id;
    this.el.attr('autocomplete', 'off');
    this.suggestions = [];
    this.data = [];
    this.badQueries = [];
    this.selectedIndex = -1;
    this.currentValue = this.el.val();
    this.intervalId = 0;
    this.cachedResponse = [];
    this.onChangeInterval = null;
    this.ignoreValueChange = false;
    this.serviceUrl = options.serviceUrl;
    this.isLocal = false;

    //this.options.fnFormatResult = fnFormatResult();

    this.options = {
      autoSubmit: false,
      minChars: 1,
      maxHeight: 300,
      deferRequestBy: 0,
      width: 0,
      highlight: true,
      params: {}, 
      fnFormatResult: fnFormatResult,      
      delimiter: null,
      zIndex: 9999
    };
    this.initialize();
    this.setOptions(options);
  }

in there

this.options = {
  autoSubmit: false,
  minChars: 1,
  maxHeight: 300,
  deferRequestBy: 0,
  width: 0,
  highlight: true,
  params: {}, 
  fnFormatResult: fnFormatResult,      
  delimiter: null,
  zIndex: 9999
};

it has define a function to format the result

fnFormatResult: fnFormatResult,   

i want to use a function other than fnFormatResult like fnFormatResult2 .

i want to change the calling function acording to a parameter pass to the plugin

i need to do like this

if(param == 1){
 fnFormatResult: fnFormatResult,   
}
else if(param == 1){
 fnFormatResult: fnFormatResult2,   
}

how can i do this . please help………………….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:18:22+00:00Added an answer on May 25, 2026 at 3:18 am

    Hmm, I guess you can do:

    this.options = {
      autoSubmit: false,
      minChars: 1,
      maxHeight: 300,
      deferRequestBy: 0,
      width: 0,
      highlight: true,
      params: {}, 
      fnFormatResult: function(value, data, currentValue) {
        if(param==1) {
          return fnFormatResult.call(this, value, data, currentValue);
        } else if (param==2) {
          return fnFormatResult2.call(this, value, data, currentValue);
        }
      },      
      delimiter: null,
      zIndex: 9999
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi i am using Ajax AutoComplete for jQuery library http://www.devbridge.com/projects/autocomplete/jquery/ there are 2 demos
I'm referencing the jQuery autocomplete plugin code seen in this tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/how-to-use-the-jquery-ui-autocomplete-widget/ The problem
I'm using the jQuery AutoComplete plugin combined with ajax. Do you know how can
I am using the jQuery autocomplete plugin . Is there a way that when
i have an input using the jquery autocomplete plugin. with this i want to
I have started using ajax/jQuery in our websites / application. There are many plugins
I've been using the JQuery Autocomplete plugin with JQuery version 1.3.2, and it has
Here's my issue : using an autocomplete jQuery plugin, I'd like to avoid multiple
I am using this autocomplete Plugin which works great but the problem is $('#request_song').autocomplete({
I'm trying to write some JQuery using the AutoComplete plugin to display a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.