Is it possible to set the width of a jQuery autocomplete combobox?

后端 未结 14 2272

I am using this jQuery UI combobox autocomplete control out of the box off the jQuery UI website:

My issue is that I have multiple comboboxes on a page, and I want t

14条回答
  •  天命终不由人
    2020-12-28 14:34

    $.widget( "custom.myAutoComplete", $.ui.autocomplete, {
        options: {
            resultClass: "leanSolutions",
        },
    
        _create: function()
        {
            this._super();
        },`
    
        _renderMenu: function(ul, items)
        {
            var that = this;
            ul.addClass(that.options.resultClass);
    
            $.each( items, function( index, item ) {
                that._renderItemData( ul, item );
            });
        }
    });
    

    Now You Can do this:

    $('.myAutoCompleteBox').myAutoComplete(
     data: ...
     etc: ...
     resultClass: 'myAutoCompleteBoxResultList'
    );
    

    And then you can style it

    .myAutoCompleteBoxResultList{   
        width: 8000px;
    }
    

提交回复
热议问题