如何指定以下jQuery自动完成的结果宽度?
$( "#autocomplete" ).autocomplete({
minLength: 2,
source: function( request, response ) {
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
response( $.grep( tags, function( item ){
return matcher.test( item );
})
}
});
谢谢!
答案 0 :(得分:6)
$( "#autocomplete" ).autocomplete({
open: function() {
// After menu has been opened, set width to 100px
$('.ui-menu')
.width(100);
} ,
minLength: 2,
source: function( request, response ) {
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
response( $.grep( tags, function( item ){
return matcher.test( item );
}) );
}