Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery autocomplete no word wrap

I'm using jQuery UI's autocomplete and I've come across and issue that I can't figure out how to fix.

The issue is that when the suggestions are too long they are automatically wrapped to take up multiple lines. I would like to have the suggestions window extend to a max size and not show the overflow. The thing is that I would like for the suggestions to only be displayed in one line. I don't want to set a fixed width for the suggestion box. If the suggestions are shorter in length then my max width I want jQuery UI to set the appropriate width.

like image 750
Sandy DeLeon Avatar asked Jul 03 '13 22:07

Sandy DeLeon


1 Answers

I would suggest trying something along the lines of truncating the results and putting the full result text in the hover title text.

You can truncate the result text using css:

.ui-menu-item a
    {
        max-width:100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }  

i've added to rusln's fiddle to demonstrate...

like image 89
Sam Jones Avatar answered Sep 22 '22 20:09

Sam Jones