diff --git a/example.js b/example.js index e1fb0ae..ebb42f9 100644 --- a/example.js +++ b/example.js @@ -1,3 +1,5 @@ document.addEventListener('DOMContentLoaded', () => { - new Kanblendar(); + const kanblendar = new Kanblendar(); + const createTaskBtn = document.getElementById('createTaskBtn'); + createTaskBtn.addEventListener('click', () => kanblendar.openModal()); }); \ No newline at end of file diff --git a/kanblendar.js b/kanblendar.js index fc13970..8297cc2 100644 --- a/kanblendar.js +++ b/kanblendar.js @@ -33,7 +33,6 @@ class Kanblendar { } init() { - this.createTaskBtn = document.getElementById('createTaskBtn'); this.kanbanSection = document.getElementById('kanblendar'); if (this.config.generateModal) { @@ -44,7 +43,6 @@ class Kanblendar { this.taskForm = document.getElementById('kanblendar-taskForm'); } - this.createTaskBtn.addEventListener('click', () => this.openModal()); this.closeModal.addEventListener('click', () => this.closeModalFunc()); window.addEventListener('click', (event) => { if (event.target === this.taskModal) {