Q:

Click event doesn't fire when parsing external html

I have a project where I need to load html from an external file and add it to an existing div element.  
It works great, except that the .click() events never fire when clicking on the desired icon in the generated html. 
Code that loads the html:
$.each(data, function (index, review) {
    let html = $.parseHTML($.trim(review));

    $(html).appendTo($items);
});

Root element of the loaded html is a class named "lc-rating-wrap". 
The js that doesn't fire on click:
$(".lc-rating-wrap > .vote-wrap > .do-vote-wrap > .icon").click(function () {
    //doStuff
});

I guess it has something to do with that the elements isnt there when I load the js file?  
Am I using parseHTML() correctly? 

A:

Your content is dynamic, but your event is binded only for existing elements.  Change it to be $(static).on(event, dynamic, callback):
$(document).on('click', ".lc-rating-wrap > .vote-wrap > .do-vote-wrap > .icon", function () {
    //doStuff
});

