odin-codespace/inventory/public/js/components/addForm.js

17 lines
433 B
JavaScript

function addForm() {
let buttonClicked = true;
const addFormClass = document.querySelector(".add-form");
if (addFormClass != null) {
const button = document.querySelector(".add-btn");
button.addEventListener("click", () => {
buttonClicked
? (addFormClass.style.display = " block")
: (addFormClass.style.display = "none");
buttonClicked = !buttonClicked;
});
}
}
export { addForm };