<div class="container">
<div class="text-center">
<button class="btn btn-primary btn-sm openclose">Open</button>
<div id="content" class="alert alert-success d-none"> Tutorial by Eddie Kidiw</div>
</div>
</div>
.container{
padding-top:50px;
}
//Tutorial by Eddie Kidiw
//https://www.eddiekidiw.org
$(document).ready(function(){
$(".openclose").click(function(){
var check=$(".openclose").text().trim();
if(check=="Close"){
 $(".openclose").text("Open");
 $("#content").addClass("d-none");
 }else{
 $(".openclose").text("Close");
 $("#content").removeClass("d-none");
 }
 });
 });


External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/css/bootstrap.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/js/bootstrap.min.js