Bind an event to a dynamic loading elements on page
I got lot of divs on my page with the class of prodct-item-info. I've
wrote a code in jQuery that trigger some code whenever the user click on
an element that has this class.
Problem is, the page is loading more of this class dynamically, and when
that happens, it's like when I press on this class of the new loaded
class, nothing happens, but if i'm clicking on the classes that were
created before the dynamic load, it still works.
for instance, x is what I loaded at the first time when the page loaded,
and y is what I added dynamically:
the page has this:
x x x x x x x x x x x x x x x x x x
when I click on those its all fine.
now I loaded
y y y y y y y y
When I click on those, it doesnt do anything.
Any idea how to fix it?
Thanks in advance!
No comments:
Post a Comment