The drop-down list when hovering over the element field when the contents of the line is long? (Django-Select2)

Good day! I have data to display in a row. I use such an element as a choice in a drop-down list. I have a very large long line of about 100 characters and I would like to have line breaks. I plan to display a drop-down list in a form.

I read that you can come up with something like this -

  • shorten the line - the number of words, characters and make the end of the list in the form of three dots.

And when hovering or selecting an element, open something like tooltips with the full name of the content when hovering. Is it possible to do something similar through such add-ons as? Django-Select2 django-autocomplete-light

Is it possible to do this?

Yes - but it won’t be Django doing it.

You need to find a JavaScript library that will manage the select lists in the way you desire, and then figure out how to render that widget to create the data structure necessary to support it. (I do not see anything in the docs where the Select2 library provides this facility, which means you probably need to find a different module.)

The intrinsic way of doing this is by using the title attribute on the option element.

You might also want to see Customizable select elements - Learn web development | MDN for some other ideas.