sophanith sophanith - 4 months ago 6
Javascript Question

Mouse event doesn't trigger in jquery

The class ".folders" doesn't trigger any events. Actually, all the classes within ".data" class doesn't trigger the mouse events. I have tried with ".search" class and it worked fine.

enter image description here

Answer

Delegate your event if they are dynamically added

$('.data').on('click','.folders',function(){
 //click event
});

else make sure you element are visible on the page and not overlapping with any existing divs

Comments