Answer the question
In order to leave comments, you need to log in
Need help with the Advanced AJAX Product Filters for WooCommerce plugin?
There is a site xn--d1asacbf5i.xn--p1ai/product-category/picca when you click on the photo, a modal window opens with a product card, when you click on order, the product is added to the cart. There is a filter on the product attributes on the left. When you click on any filter, everything works, products with the selected attribute appear, but then all scripts fly off, when you click on the photo of the product, the window does not open, the order button does not work. What could be the problem ?
Answer the question
In order to leave comments, you need to log in
And the point, in fact, is in the wrong installation of the event handler. For dynamically added document elements, delegated event handling must be used. This is when the handler is set not on the element itself, but on its parent element. In fact, a handler, for example, click, can even be set to document, but in order to avoid unexpected situations, it is better to set it to the nearest static "parent", i.e. the parent element that was there when the DOM was originally loaded.
$('.parent_static').on('event', '.child_dynamic_elements', handler);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question