michaelfurey Posted May 15, 2017 Share Posted May 15, 2017 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? Quote Link to comment https://forums.phpfreaks.com/topic/303940-select-showing-options-without-click/ Share on other sites More sharing options...
requinix Posted May 15, 2017 Share Posted May 15, 2017 Sure. Do you have it at the point where it does everything except for that part? What's the code for it all? Quote Link to comment https://forums.phpfreaks.com/topic/303940-select-showing-options-without-click/#findComment-1546538 Share on other sites More sharing options...
Jacques1 Posted May 15, 2017 Share Posted May 15, 2017 size 1 Quote Link to comment https://forums.phpfreaks.com/topic/303940-select-showing-options-without-click/#findComment-1546539 Share on other sites More sharing options...
requinix Posted May 16, 2017 Share Posted May 16, 2017 Ohh... Quote Link to comment https://forums.phpfreaks.com/topic/303940-select-showing-options-without-click/#findComment-1546551 Share on other sites More sharing options...
michaelfurey Posted May 16, 2017 Author Share Posted May 16, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303940-select-showing-options-without-click/#findComment-1546557 Share on other sites More sharing options...
requinix Posted May 16, 2017 Share Posted May 16, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/303940-select-showing-options-without-click/#findComment-1546558 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.