简体   繁体   中英

What libraries do I need to import in order to use jQuery Autocomplete

I have been tinkering with the jQuery autocomplete, and I got some parts of it to work here: http://problemio.com/test.php

Now I am working from this article: http://net.tutsplus.com/tutorials/javascript-ajax/how-to-use-the-jquery-ui-autocomplete-widget/

And this article says I need to download these libraries: Core, Widget,Position and use their css also.

I already import this on my page:

          <link rel="stylesheet" type="text/css" href="http://jqueryui.com/themes/base/jquery.ui.all.css"/>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>

<script type="text/javascript" src="http://www.problemio.com/js/problemio.js"></script>

so does that mean I need to import some more libraries? Which ones exactly? The example tutorials suggest I download the libraries, what is the main difference between downloading the libraries and just importing them? Also, even if I download them, what should the paths point to since the libraries have more than 1 file?

Thanks!!

The answer is always in the source,

/*
 * jQuery UI Autocomplete 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *  jquery.ui.core.js
 *  jquery.ui.widget.js
 *  jquery.ui.position.js
 */

And from Autocomplete

The jQuery UI Autocomplete plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain.

If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.autocomplete.css stylesheet that can be modified. These classes are highlighed in bold below.

I recommend reading the Getting Started info before continuing.

No. Core, widget, etc are included in the jQuery-ui. You can include them separately if you want to reduce the amount of code loaded but loading from the Google CDN is pretty efficient.

Those are the different components of jQuery UI, which you can see and customize a download for on this page. You're linking against the Google CDN's version, which probably contains all of them, so you have all you need already.

To use the JQuery UI autocomplete plugin, you have everything you need to get started in the code you posted. You only need additional files if you're trying to more than the stock auto-complete action.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM