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

  • SEARCH
  • Home
  • 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 6896179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:00:09+00:00 2026-05-27T07:00:09+00:00

I am new to jquery. I am using the below code for showing autosuggest

  • 0

I am new to jquery.
I am using the below code for showing autosuggest in text box.

$().ready(function() {
    function formatItem(row) {
        return row[0] + " (<strong>id: " + row[1] + "</strong>)";
    }

    function formatResult(row) {
        return row[0].replace(/(<.+?>)/gi, '');
    }

    //$("#suggest1").autocomplete(cities);  

    $("#custName").autocomplete(arrNames, {
        multiple: false,
        minChars: 0,
        width: 190,
        matchContains: true,
        autoFill: false,
        mustMatch: true,
        max: 20,                
    }
});
});

My problem is I want to call a javascript function along with the index of arrNames as parameter when user select one name from autosuggest. Please help me.

  • 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-27T07:00:10+00:00Added an answer on May 27, 2026 at 7:00 am

    Here is how you do it (using jQuery ui autocomplete) :

    $("#custName").autocomplete(
            source: arrNames,
            select: function (event, ui) {
               //Do stuff here
            }     
        }
    

    From jqueryUI website :

    Select

    Triggered when an item is selected from the menu; ui.item refers to
    the selected item. The default action of select is to replace the text
    field’s value with the value of the selected item. Canceling this
    event prevents the value from being updated, but does not prevent the
    menu from closing.

    EDIT :

    It seems you are using Autocomplete plugin from http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

    This plugin is deprecated… You should use jQuery ui autocomplete : http://jqueryui.com/demos/autocomplete/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to jquery ! I am using the code below to insert
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to
Using the jQuery code below, I'm trying to take a JSON object to create
How can I format the date using jQuery. I am using below code but
Currently I have the below jQuery which uses the colorbox plugin http://colorpowered.com/colorbox/ $(document).ready(function(){ $(.altbgcolor).hover(function()
i am using below code to show google map in asp.net MVC2: <script type=text/javascript
I am new to using jquery and would like to know how to append
I am relatively new to using jQuery and would like to use the load
I am trying to open a few links in a new window using Jquery
I'm using jQuery to dynamically add new divs containing a few fields. I'm adding

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.