JQuery autocomplete no word wrap

I am using jQuery UI autocomplete and I ran into a problem and I cannot figure out how to fix this.

The problem is that when sentences are too long, they automatically end to deal with several lines. I would like the suggestion window to expand to its maximum size and not display overflow. The fact is that I would like for offers to be displayed on only one line. I do not want to set a fixed width for the proposal window. If the sentences are shorter in length then my maximum width I want the jQuery UI to set the appropriate width.

+4
source share
1 answer

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

You can trim the result text with css:

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

I added a fiddle to rusln to demonstrate ...

+5
source

Source: https://habr.com/ru/post/1489594/


All Articles