mrVG mrVG - 1 year ago 67
Javascript Question

JQuery click is not working

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() {

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
, but still no progress. What I'm missing?

EDIT: This element is not drowing by ajax.

Answer Source

Please apply click using following way


It will work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download