Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
70 views
in Technique[技术] by (71.8m points)

javascript - How do I set a certain number of options in select 2?

I need to make an analog of the size attribute in the Select2 plugin as in the default select. I can't find it in the docks. Here's how implemented in default

Sorry for English :)

enter image description here

question from:https://stackoverflow.com/questions/65884459/how-do-i-set-a-certain-number-of-options-in-select-2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In html you can use disabled ether on the entire selection or option as showing in your image, here is an example :

  <select>
    <option value="1" disabled>option 1</option>
    <option value="2">option 2</option>
    <option value="3">option 3</option>
    <option value="4" disabled>option 4</option>
  </select>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...