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

后端 未结 14 2324

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:27

    I think the easiest way to do it is to capture the open event and then set the width there:

    $("#autocompleteInput").bind("autocompleteopen", function(event, ui) {
      var width = 300;
      $(".ui-autocomplete.ui-menu").width(300);
    });
    

    Since only one autocomplete menu can be active at one time, it's okay to just change the width for the menu class.

提交回复
热议问题