user1827257 user1827257 - 11 months ago 59
jQuery Question

Disable bootstrap collapse hide function when content is visible/expanded

I have really simple question. A want to use Bootstrap 3 collapse function for showing up some content BUT i want to disable


So, when i click on some link or button, some content appears, but when content is once
and i click on the link one more time, content should retain visible (so i can highlight content instead of hiding on link clicks see example).

My specific usecase:

<button class="reply-link note date" data-toggle="collapse" aria-expanded="false" aria-controls="reply-form" data-target="#reply-form">reply</button>
<div id="reply-form" class="collapse media">
reply form html code ...

I want to show up
reply form
reply button
. Next reply button click will not hide the reply form but add focus on some reply form element.

Is there some common way how to do this by using Bootstrap 3?


Answer Source

Handle the shown event of the collapse to disable (or hide, remove, etc..) the trigger button..

$('#collapseExample').on('', function () {