Javascript toggle with Bootstrap collapse plugin

后端 未结 3 1719
借酒劲吻你
借酒劲吻你 2021-01-12 00:05

I try to use the toggle function of the Bootstrap collapse plugin programmatically. I manage to toggle a div when I click on the link in accordion-heading but it works only

3条回答
  •  时光取名叫无心
    2021-01-12 00:39

    I found that simply invoking the collapse twice, once with parent and once without, does the trick quite nicely - this solution was preferable in my solution due to the hierarchy.

    onclick="
    $('@("#collapse" + lead.LeadId)').collapse({parent: '#accordion', toggle: true});
    $('@("#collapse" + lead.LeadId)').collapse('toggle');"
    

提交回复
热议问题