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
JavaScript
var $myinput = $('#myinput').autocomplete({source: ['ABC', 'BCD', 'CDE']})
$myinput.data('autocomplete').menu.element.addClass('myautocomplete');
CSS
.myautocomplete{width:300px!important;}
You can't set the width
directly, because it will get overwritten. But you can set the min-width
directly.
var $myinput = $('#myinput').autocomplete({source: ['ABC', 'BCD', 'CDE']})
$myinput.data('autocomplete').menu.element.css('min-width', '300px');
Simply use the jQuery CSS method:
css("width", "300px");
http://api.jquery.com/css/#css2
You can append this after adding your combobox.
How do you use the combobox in your code?