Why I cannot assign event listner to a button? : Here's the code to add event listeners to all the button elements in my html. Why does it not work?

    window.onload = function(){
        addEvListeners();
        // This function is to assign ELs to buttons in my HTML
        function addEvListeners(){
            var target = document.getElementsByTagName("button");
            for (i = 0; i <= target.length - 1; i ++){
                target[i].addEventListener("click", function(){model();},false);
            }
        }
        function model(){
            return true; // just for placeholder
        }
    }