简体   繁体   中英

jQuery ui autocomplete - .ui-autocomplete-loading

I'd like to apply this css to the search box while it is fetching the XML file. Currently it takes ~3 seconds to load this file.

I see in the autocomplete.js file these two functions:

    _search: function( value ) {
    this.term = this.element
        .addClass( "ui-autocomplete-loading" )
        // always save the actual value, not the one passed as an argument
        .val();

    this.source( { term: value }, this.response );
},

_response: function( content ) {
    if ( content.length ) {
        content = this._normalize( content );
        this._suggest( content );
        this._trigger( "open" );
    } else {
        this.close();
    }
    this.element.removeClass( "ui-autocomplete-loading" );
},

I'm just not sure how and where to trigger that in my code.

Thanks

$("#name").addClass( "ui-autocomplete-loading" );

做了它.removeclass删除它

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