Javascript toggle with Bootstrap collapse plugin

后端 未结 3 1704
借酒劲吻你
借酒劲吻你 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:43

    Similar problem, I just check if the element is visible:

    $("#myDiv").is(":visible") ? $("#myDiv").collapse('hide') : /*do nothing*/;
    

提交回复
热议问题