Jquery: Click event doesn't work after append. (Don't know how to use .ON)
I have 2 click events. One appends an IMG which includes another click
event. It doesn't work obviously. I know that I have to use jQuery's .ON,
but I just can't figure out how and where.
My code:
$( document ).ready(function() {
// The one below (.choimh) isn't triggered anymore
$('.choimg').click(function(){
});
// Switch to chosen color
$('.color').click(function(){
$(".thumbs").append('<a href="#"><img id="image'+u+'"
class="choimg" src="/img/products/mini/'+colnumber+'-'+ i + '.jpg"
/>');
});
});
The .color div is on a completely different place than .choimg.
I just can't figure out how to use .ON.
No comments:
Post a Comment