To clarify the question, let me give the example like below.
I have three <div>
elements like below:
<div id="fail-item" class="toolbar-item">
Fail
</div>
<div id="warn-item" class="toolbar-item">
Warn
</div>
<div id="pass-item" class="toolbar-item">
Pass
</div>
I added click listener for each <div>
listed with Jquery like below:
<body>
<script>
$("div.toolbar-item").click(toolbar_click_listener());
function toolbar_click_listener(){
console.log("what happens");
}
</script>
</body>
However, I can see "what happens" printed only once when I load the page, any further click event to those <div>
elements doesn't work at all.
I searched over SO but failed to get answers. Do you know what's wrong here?