I'm trying to click a class with jquery in wordpress. Here is my code
import $ from 'jquery';
class Scroller {
constructor() {
this.events();
}
events() {
alert("hi");
$(".load-more").on("click", this.test_func.bind(this));
}
test_func() {
alert("yo");
}
}
When i run this code the alert for hi shows up, but then when i click .load-more nothing happens.
I know jquery is set up because when i run this js file (targetting the same class) instead, it works:
jQuery(document).ready(function ($) {
$(document).on('click', '.load-more:not(.loading)', function () {