3

我将如何为以下 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 );
        })
    }
});

谢谢!

4

1 回答 1

7
$( "#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 );
}) );
}
于 2013-04-29T10:02:09.030 回答