Onclick method running before click event.

by Ariel Balter

HTML

<div id="tour" data-location="london">
    <button>Get Photos</button>
    <ul class="photos"></ul>
</div>

JavaScript

var tour = {
    init: function () {
        $("#tour").on("click", "button", alert("clicked"));
    }
};
$(document).ready(function () {
    alert("hello");
    tour.init();
});