Can I replace a method on a jQuery UI object? How?

Posted by Cheeso on Stack Overflow See other posts from Stack Overflow or by Cheeso
Published on 2010-03-12T22:28:15Z Indexed on 2010/03/12 22:37 UTC
Read the original article Hit count: 166

Filed under:

If I want to tweak some of the capability of a jQuery UI object, by replacing one of the functions, how would I go about doing that?

Example: suppose I wanted to modify the way the jQuery autocomplete widget rendered the suggestions. There's a method on the autocomplete object that looks like this:

_renderItem: function( ul, item) {
    return $( "<li></li>" )
        .data( "item.autocomplete", item )
        .append( "<a>" + item.label + "</a>" )
        .appendTo( ul );
},

Could I replace this? How? What syntax would I use?

© Stack Overflow or respective owner

Related posts about jQuery