Jump to content


Photo

select showing options without click

select html css jquery

  • Please log in to reply
5 replies to this topic

#1 michaelfurey

michaelfurey
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 15 May 2017 - 02:54 PM

I would like to create a select that shows immediately some option values without waiting that the user clicks on the arrow in order to see the option values... is it possible?

 

 



#2 requinix

requinix
  • Administrators
  • Lazy Administrator
  • 9,374 posts
  • LocationWA

Posted 15 May 2017 - 03:13 PM

Sure. Do you have it at the point where it does everything except for that part? What's the code for it all?
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#3 Jacques1

Jacques1
  • Members
  • PipPipPip
  • Turtles all the way down
  • 4,224 posts

Posted 15 May 2017 - 03:29 PM

size



#4 requinix

requinix
  • Administrators
  • Lazy Administrator
  • 9,374 posts
  • LocationWA

Posted 16 May 2017 - 12:12 AM

Ohh...
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#5 michaelfurey

michaelfurey
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 16 May 2017 - 08:06 AM

This is my code:

<script type="text/javascript">
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
</script>

<select class="js-example-basic-single">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
  <option value="fiat">Fiat</option>
  <option value="mercedes">Mercedes</option>
  <option value="bmw">BMW</option>
  <option value="tata">Tata</option>
</select>

Unfortunately I am using Select2 that is a plugin of jquery... I have the impression that the attribute size doesn't work with it.



#6 requinix

requinix
  • Administrators
  • Lazy Administrator
  • 9,374 posts
  • LocationWA

Posted 16 May 2017 - 08:39 AM

select2 has a style for interacting with the list that doesn't work with the idea of showing options before they're selected. You need to choose which style you prefer.
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users