Search code examples
javascriptrevealing-module-pattern

addEventListener Module Pattern


I don't know why but when I click on "button" nothing happens...

No message in console, no error. How to fix it ?

JS

var bird = (function(){

    let button    = document.querySelector('#addBird');

    button.addEventListener('click', addBird);

    function addBird()
    {
       console.log('addBird');
    };

    return {
        addBird: addBird
    };
})();

HTML

<button id="addBird">Add Bird</button>

Solution

  • Ok if I insert and outside the #birdMod It works... So it was not the .render() function. Thank you for your help. :)