Changing width of jquery-ui autocomplete widgets individually

前端 未结 11 889
挽巷
挽巷 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:02

    You can get "ui-menu" widget attached to the having autocomplete with respect of $('#myinput').data("autocomplete").menu. So to change the width you can use

    $('#myinput').autocomplete({
        source: yourUrlOrOtherSource,
        open: function () {
            $(this).data("autocomplete").menu.element.width(80);
        }
    });
    

提交回复
热议问题