4

I have select and option tags in my HTML page.

<select>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock.">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock.</option>
</select>

My last option has a big text retrieving from database and it is bigger than the select box.

Is it possible to make this <option> value double line or multi line by CSS or Javascript like below ?

Option Select

I found this but I could not understand.

UPDATE:

Somebody marked my question as already answered here. But this link is not working.

I can limit my character count by sql query. But this is not the solution.

Community
  • 1
  • 1
Raja
  • 772
  • 1
  • 15
  • 38
  • 3
    your html is buggy, it should be `` – Manoz Feb 17 '15 at 13:28
  • 1
    possible duplicate of [Word wrap options in a select list](http://stackoverflow.com/questions/3587942/word-wrap-options-in-a-select-list) –  Feb 17 '15 at 13:31
  • @Manoz It is just for example. I didn't forget the `value` part for the best of my knowledge. Please, if you have the answer, post it. – Raja Feb 17 '15 at 13:31
  • In the solution you found it says that it doesn't work on all the browsers and that you should try adding tags inside `` item – Fourat Feb 17 '15 at 13:32
  • possible duplicate of [How can I build a – Ajay Feb 17 '15 at 13:39
  • 1
    @Raj, Maybe the result is no. http://stackoverflow.com/questions/4258723/fix-size-drop-down-with-long-text-in-options-restricted-view-in-ie – Manoz Feb 17 '15 at 13:46

2 Answers2

2

Please try jQuery-Selectric this plugin which possibly solve your issue.

Anwar Hussain
  • 450
  • 2
  • 12
  • 1
    OK so jQuery isn't a solution to anything frankly. Fantastic framework but it's not an answer to an HTML question and certainly doesn't apply to any of the newer frameworks (that first emulated then dumped jQuery). – Rick O'Shea Apr 28 '17 at 22:57
0

Nope it is not possible with the standard option tag. Try plugin menu's, there are tons. like this

VaMoose
  • 196
  • 7