Prev Demo
Bootstrap
>
Collapse Events
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Collapsible Events</h2> <button type="button" class="btn btn-success">Show</button> <button type="button" class="btn btn-warning">Hide</button> <div class="collapse"> TechFunda is a online tutorial </div> </div> <script> $(document).ready(function () { $(".btn-success").click(function () { $(".collapse").collapse('show'); }); $(".btn-warning").click(function () { $(".collapse").collapse('hide'); }); $(".collapse").on('show.bs.collapse', function () { alert('The collapsible content is about to be shown.'); }); $(".collapse").on('shown.bs.collapse', function () { alert('The collapsible content is now fully shown.'); }); $(".collapse").on('hide.bs.collapse', function () { alert('The collapsible content is about to be hidden.'); }); $(".collapse").on('hidden.bs.collapse', function () { alert('The collapsible content is now hidden.'); }); }); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output