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 8685475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:34:53+00:00 2026-06-12T22:34:53+00:00

I am trying to create an autocomplete with category option, but when i am

  • 0

I am trying to create an autocomplete with category option, but when i am trying it by using catcomplete i am getting errors;

  1. TypeError: $.widget is not a function
    “localhost/php25/js/jquery.ui.widget.js”
    Line 67

  2. TypeError: base is not a constructor
    “localhost/php25/js/jquery.ui.widget.js”
    Line 67

  3. TypeError: $(“#search”).catcomplete is not a function
    “localhost/php25/index.php”
    Line 50

Here is my code:

<html>
<head>
    <meta charset="utf-8">
    <title>Hello</title>
    <script type="text/javascript" src="js/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="js/jquery.ui.autocomplete.js"></script>
    <script type="text/javascript" src="js/jquery.ui.core.js"></script>
    <script type="text/javascript" src="js/jquery.ui.position.js"></script>
    <script type="text/javascript" src="js/jquery.ui.widget.js"></script>

    <style type="text/css">
        .ui-autocomplete{
            padding: .2em .4em;
            margin: .8em 0 .2em;
            line-height: 1.5;
        }
    </style>

    <script type="text/javascript">
        $.widget( "custom.catcomplete", $.ui.autocomplete, {
            _renderMenu: function( ul, items) {
                var self = this, 
                currentCategory = "";
                $.each( items, function(index, item){
                    if( item.category != currentCategory){
                        ul.append( "<li class='ui-category'>" + item.category + "</li>");
                        currentCategory = item.category;
                    }
                    self._renderItem( ui, item);
                });
            }
        });
    </script>

    <script type="text/javascript">
        $( function(){
            var data =  [
                {label:"London Biggin Hill Arpt,BQH,United Kingdom",category:"airport"},
                {label:"Longvic Airport,DIJ,France",category:"airport"},
                {label:"Long Island Arpt,HAP,Australia",category:"airport"},
                {label:"Long Island Macarthur Arpt,ISP,United States",category:"airport"},
                {label:"Long Banga Airfield Arpt,LBP,Malaysia",category:"airport"},
                {label:"Longview,United States",category:"city"},
                {label:"Long Island,Australia",category:"city"},
                {label:"Long Banga,Malaysia",category:"city"},
                {label:"Long Bawan,Indonesia",category:"city"},
                {label:"Londrina,Brazil",category:"city"}
            ]; 
            $('#search').catcomplete({
                source: data 
            });
        });
    </script>
</head>

<body>
    <label for="search">Search: </label>
    <input id="search" type="text" />
</body>
</html>

I just wrote my code similar to that shown in http://jqueryui.com/autocomplete/#categories

can anyone help me out plz.

  • 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-06-12T22:34:54+00:00Added an answer on June 12, 2026 at 10:34 pm

    Your JavaScript include order is wrong. Move autocomplete.js to the end of the script tags.

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

Sidebar

Related Questions

I'm trying to create an auto-complete function for the ICSharpCode.TextEditor. But the fileTabs_KeyDown doesn't
I am trying to create an autocomplete textbox using jquery which will be bound
I was trying to create an autocomplete field using jquery and ajax. I tried
I'm trying to create a custom field type with jQuery autocomplete functionality. But I'm
I'm trying to advance the Jquery-autcomplete function. I want Jquery-autocomplete to create new rows
I am trying to create an autocomplete field with jquerys famous autocomplete and by
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
Trying to create a black line in my view to separate text blocks but
Trying to create a new Dedicated Cache Role in Windows Azure but get the

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.