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
  • 15 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
  • Forgotten Administrator
  • 8,619 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?

#3 Jacques1

Jacques1
  • Gurus
  • Turtles all the way down
  • 3,715 posts

Posted 15 May 2017 - 03:29 PM

size



#4 requinix

requinix
  • Administrators
  • Forgotten Administrator
  • 8,619 posts
  • LocationWA

Posted 16 May 2017 - 12:12 AM

Ohh...

#5 michaelfurey

michaelfurey
  • Members
  • PipPip
  • Member
  • 15 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
  • Forgotten Administrator
  • 8,619 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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users