Changing width of jquery-ui autocomplete widgets individually

前端 未结 11 876
挽巷
挽巷 2020-12-14 16:42

I\'m working with mutiple jquery-ui autocomplete widgets on one page and want to be able to set the widths of each one individually. Currently, I\'m doing it like this:

11条回答
  •  天涯浪人
    2020-12-14 17:06

    As of jQuery UI 1.10, the autocomplete widget was rewritten using the widget factory. As part of that, the autocomplete now contains a _resizeMenu extension point, which is called when sizing the menu before displaying.

    $('#input').autocomplete({  
        source: mysource,  
        appendTo: '#div',  
        _resizeMenu: function() {
            this.menu.element.outerWidth( 500 );
        }
    });
    

提交回复
热议问题