Hi
I need help with a button dropdown, bs 3, something is wrong with it. clicking on it , I get the dropdown but it doesn’t happen more. I would expect the same results like the other input fields.
yje code:
The bootstrap dropdown is just a dropdown menu. It is not a replacement for a select element.
If you want it to behave like a select element then you will need to code it yourself and swap the values dynamically at the same time as updating a hidden select.
There are plenty of plugins for select elements so it may be easier to use one of them rather than writing your own.
Alternatively just use a select element as that was what it was made for
thank you for help. select is html, can be used in bs 3? bs 3 has list group. can you help me to get a correct code instead of broken fantasy solution? thank you.
As I said you will need to use a select element then add the plugin code to convert it. It won’t be exactly the same as yours but you should get close enough. I’ve pulled some relevant parts from your page and used this plugin:
(Please check the license and documentation meets your needs (there are many other plugins like this).
The basic result is here but you may need to re-style to your own choice.
It’s quite complex because you have to use classes on each column parent to style the newly inserted html the way that you want.
On the backend it should submit the correct results from the hidden select. For error checking and testing you would need the help of the other @Paul_Wilkins in the JS forum as I have merely used a plugin and adjusted the styling to match. The JS is beyond me.
Remember the html you are working with will be as seen in the devtools window and not the original select which is just used for sending the data.
Thank you for help, it is lovely. I noticed another problem: as the view port shrinks the “Please choose” goes behind buttons instead of the top of buttons, I don’t understand why. Can you help me please? thank you.
thank you for help. I changed the mentioned part, the informative part doesn’t go behind the buttons but doesn’t go above buttons neither when view port shrinking. please help me thank you.
I’m out this evening and will check tomorrow but before I look at it can you tell me what the experiment is trying to do and what you think is wrong or right about it?
I am trying to replicate the code you gave me, using bootstrap select. I want to make sure my code has no mistake.
also , styling: I am wondering, how can I do that? my similar previous experiments are useful? or I need to adapt them? can you help me please?
thank you…
I gave you all the code for that in my codepen. It’s based on your css and html.
I explained how to style it and indeed have already styled it to match your original. It should be straight forward as I have done all the work for you.
If you are using the plugin I suggested then you need to add the class of dropdown-select to the select otherwise the js won’t find anything to work on.
Note that you have duplicated your ids on some of the selects and ids must be unique so check your labels and selects match up and that their ids are unique. Also you can’t nest columns within columns in bootstrap unless you nest another row first. Please make sure you bootstrap grid is valid and according to the docs.
To style the dynamically inserted html you can add a class to a parent and then use that class to style the newly inserted dwopdown.
e.g. to style the button 1 colour you would do this
If you look at the previous codepen I gave you I styled the 2 button colours and the colours of the dropdown background etc so you have a complete template to follow. You have all the information you need to complete this task now
thank you for help.
I would like to ask, how can I submit multiple button selections? I choose something from a button dropdown, then another choice from another button and submit the chosen options? is it happen one by one or i can submit in one go all of them thank you.