I'm trying to animate my Create Note form in when I click on a button but it just immediately comes in without a transition. What I'm trying to do is to add a class that sets its display from 'none' to 'flex'.
This is how the form looks (HTML)
//Finally, this is the javascript that I'm trying to get it to work
const createBtn = document.getElementById('createBtn');
const form = document.getElementById('noteForm');
createBtn.addEventListener('click', () => {
form.classList.toggle('active');
});
.active {
display: flex;
}
form {
display: none;
/* other propertites */
transition: all 250ms ease-in;
}
<button id="createBtn">Create a Note</button>
<form id="noteForm">
<!--form Content-->
<input type="text">
</form>
I am not sure if this is the correct way to be animating things in but I want to know how I can pull something like this off with vanilla JS.