MeltingDog
MeltingDog

Reputation: 15458

Way to trigger Bootstrap's Collapse without using Buttons or A tags?

A need to trigger Bootstrap's Collapse when a user clicks a Radio button, eg:

<input type="radio" name="radios" value="More" data-toggle="collapse" href="#collapseExample">

<div class="collapse" id="collapseExample">
</div>

But the above doesn't work.

I could wrap it in an a tag but that would play havoc with my styles.

Would anyone know if it's possible to trigger the collapse on click of any element?

Upvotes: 0

Views: 2000

Answers (1)

Shady Alset
Shady Alset

Reputation: 5714

Try using .collapse('show'); :

$('#trigger').click(function(){
    $('#collapseTwo').collapse('show');
});

See JsFiddle DEMO

Upvotes: 1

Related Questions