Skip to content
Advertisement

Radio Button not working with data-toggle while using bootstrap accordion

I want to select radio button options and also want to use the bootstrap accordion but when the data-toggle is used then the radio button options are not selected. How can I use that for the purpose?

JavaScript

Advertisement

Answer

HTML Code Snippet

JavaScript

JS Code Snippet

JavaScript

What I have done is – used JQuery to trigger the event of anchor tags when the radio button is clicked, as both of them has their own default click events, thus anchor cannot take radio buttons as child. So, to make things work, I used them as sibling elements, and trigger the anchor’s click event when radio button is pressed

Hope this is what you were expecting for!! Thanks

Please Check this Codepen Snippet, for further reference.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement