javascript - HTML select option multiline value - Stack Overflow

I have select and option tags in my HTML page.<select><option value="1">1<opt

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 ?

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.

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 ?

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.

Share Improve this question edited May 23, 2017 at 12:02 CommunityBot 11 silver badge asked Feb 17, 2015 at 13:26 RajaRaja 7922 gold badges15 silver badges38 bronze badges 6
  • 3 your html is buggy, it should be <option value=''>content</option> – Manoz Commented Feb 17, 2015 at 13:28
  • 1 possible duplicate of Word wrap options in a select list – user2010925 Commented Feb 17, 2015 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 Commented Feb 17, 2015 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 <option></option> item – Fourat Commented Feb 17, 2015 at 13:32
  • 1 @Raj, Maybe the result is no. stackoverflow./questions/4258723/… – Manoz Commented Feb 17, 2015 at 13:46
 |  Show 1 more ment

2 Answers 2

Reset to default 2

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745040791a4607793.html

相关推荐

  • javascript - HTML select option multiline value - Stack Overflow

    I have select and option tags in my HTML page.<select><option value="1">1<opt

    8小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信