Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify jQuery Auto-Complete Results Width

How would I specify the width of the results for the following jQuery Auto-Complete?

$( "#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 );
        })
    }
});

Thanks!

like image 723
NCoder Avatar asked Feb 15 '26 18:02

NCoder


1 Answers

$( "#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 );
}) );
}
like image 69
PSR Avatar answered Feb 19 '26 10:02

PSR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!