SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jul 2013
    Location
    South of the equator, then turn left
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What to do with jQueryUI autocomplete?

    Hi all,

    I have "successfully implemented" a number of jqueryui widgets/plugins but am at a loss as to what to do with the autocomplete plugin. Do you integrate the plugin with a website search engine or what?

    I've seen an autocomplete plugin that includes links to other pages in the results. So if I select "Berlin" in will automatically load the "Berlin" page.

    How would I go about doing this? Please advise me.

    Thank you!!!

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    From the Autocomplete | jQuery homepage:

    The datasource is a simple JavaScript array, provided to the widget using the source-option.
    This means that in its simplest form, you point the plugin at an array like this:

    Code:
    var availableTags = [
          "ActionScript",
          "AppleScript",
          "Asp",
          "BASIC",
          "C",
          "C++",
          "Clojure",
          "COBOL",
          "ColdFusion",
          "Erlang",
          "Fortran",
          "Groovy",
          "Haskell",
          "Java",
          "JavaScript",
          "Lisp",
          "Perl",
          "PHP",
          "Python",
          "Ruby",
          "Scala",
          "Scheme"
        ];
    and it will filter the results depending on what is typed.

    You might notice however, that there is a remote option, in which case the datasource is a server-side script which returns JSON data, specified via a simple URL for the source-option.

    To make your page load a new page based on the user's input shouldn't be too hard.
    You would probably have to hook into the select event, which is triggered when an item is selected from the menu.

    If you have any questions about the implementation, just let me know.

  3. #3
    SitePoint Addict
    Join Date
    Jul 2013
    Location
    South of the equator, then turn left
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Pullo,

    thank you for taking the time to clarify this. I'm relatively new to JavaScript and jQuery, so when I tried the autocomplete widget a few months back it didn't work. Perhaps this time around...


    Thanks again!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •