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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:31:31+00:00 2026-05-27T06:31:31+00:00

Is it possible to work with combobox as with usual jquery-ui ajax autocomplete field

  • 0

Is it possible to work with combobox as with usual jquery-ui ajax autocomplete field?

What I need?

I want there will be some default options and when user try to put any letters it must connect to the server to find requested information (as usual remote json autocomplete).

Is it possible at all?

  • 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-27T06:31:32+00:00Added an answer on May 27, 2026 at 6:31 am

    Here’s a heavily modified version of the jQueryUI example (gist):

    $.widget("ui.combobox", {
        _create: function() {
            var _self = this
                , options = $.extend({}, this.options, {
                minLength: 0,
                source: function(request, response) {
                    if (!request.term.length) {
                        response(_self.options.initialValues);
                    } else {
                        if (typeof _self.options.source === "function") {
                            _self.options.source(request, response);
                        } else if (typeof _self.options.source === "string") {
                            $.ajax({
                                url: _self.options.source,
                                data: request,
                                dataType: "json",
                                success: function(data, status) {
                                    response(data);
                                },
                                error: function() {
                                    response([]);
                                }
                            });
                        }
                    }
                }
            });
    
            this.element.autocomplete(options);
    
            this.button = $("<button type='button'>&nbsp;</button>")
                .attr("tabIndex", -1)
                .attr("title", "Show All Items")
                .insertAfter(this.element)
                .button({
                    icons: {
                        primary: "ui-icon-triangle-1-s"
                    },
                text: false
                })
                .removeClass("ui-corner-all")
                .addClass("ui-corner-right ui-button-icon")
                .click(function() {
                    if (_self.element.autocomplete("widget").is(":visible")) {
                        _self.element.autocomplete("close");
                        return;
                    }
                    _self.element.autocomplete("search", "");
                    _self.element.focus();
            });
        }
    });
    

    Usage:

    $("input_element_selector").combobox({
        initialValues: ['array', 'of', 'values'],
        source: /* <-- function or string performing remote search */,
        /* any other valid autocomplete options */
    });
    

    Example: http://jsfiddle.net/Jpqa8/

    The widget uses the supplied initialValues array as the source when the length of the search is “0” (this happens when the user clicks the dropdown button).

    Supply a source parameter (function or string) that performs the remote search. You can also use any other options you would usually use with the autocomplete widget.

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

Sidebar

Related Questions

Some days ago I started using partitioning to make it possible to work with
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
I need to know if it is possible to work with ExtJS 4 components
Possible Duplicate: Click trigger on select box doesn't work in jQuery I am trying
I have the following jquery script that I want to work <?php $script=<<<SCRIPT $(#btn).click(function(){
Possible Duplicate: How do emulators work and how are they written? I'd like to
Possible Duplicate: How does foreach work when looping through function results? If I have
Possible Duplicate: How does the (function() {})() construct work and why do people use
Possible Duplicate: Why doesn't this division work in python? A simple problem I'm having
Possible Duplicate: getElementByClass().setAttribute doesn't work Why this: document.getElementsByClassName('cke_source').setAttribute('name', mymessage) Is returning: TypeError: Object #<NodeList>

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.