-3

I have following simple html block:

<span class="change_ordering show-list" data-ordering-by="product_list" data-ordering-direction="desc">By list</span>

Then, I have following js-code:

$(document).ready(function() {
    $('.show-list').click(function() {
        console.log('qwe');
    });
});

When I click on it - nothing happens. But when I paste this js-code to Google Chrome JS console, it works perfectly. JS works fine on my site, I can make other JQuery actions. I also tried to write $('.change_ordering.show-list') and $('span.change_ordering.show-list') and $('span.show-list'), but still no progress. What I'm missing?

EDIT: This element is not drowing by ajax. I don't understand why it's duplicate.

mrVG
  • 45
  • 7

1 Answers1

0

Please apply click using following way

$(document).on("click",".show-list",function(){})

It will work

pareshm
  • 4,499
  • 4
  • 33
  • 50