$(document).ready(function () {
$(".messages").delay(5000).slideUp(300);
});
//
//find all buttons
document.querySelectorAll("button[data-target]").forEach(el => {
//put a click event on each button
el.addEventListener("click", ev => {
//when clicked, hide all divs
let divs = document.getElementsByClassName("sampleDiv");
for (let div of divs) {
div.style = "height:0; overflow:hidden; opacity:0; transition: opacity 0.4s ease-out; ";
}
//then show the div that this button should be showing
//by grabbing it's id from the data-target attribute and setting it's style
document.getElementById(el.getAttribute("data-target")).style = "transition: opacity 0.4s ease-out; height: auto; opacity: 1;";
});
});