I have this button:
<button type="button" id="topic_schedulati" class="btn btn-info">Mostra Topics Schedulati</button>
This is my jquery code to handle the click:
(function() {
$(window).on('action:ajaxify.end', function(event, data) {
if (new RegExp(/^category\/[0-9]+/).test(data.url)) {
$(document).ready(function(){
$('body').on('click', '#topic_schedulati', function() {
console.log("hi");
});
});
}
});
}());
Why when I click on the button I show the print "hi" two times and not one? Anyone can help me?