So with this bit of code I want to show an overlay, .mg-show-info. elInfoLink's click function works just as planned. Now I'm supposed to make it's parent clickable as well and since there is another event on that already, I figured I'd do it as you see here. Now by clicking on the parent its child's function is called, and the console.log works, but the overlay is not shown. Why?
var elInfoLink = tile.querySelector('.info-link');
if (elInfoLink) {
$(elInfoLink).parent().click(function (e) {
$(elInfoLink).click();
});
$(elInfoLink).click(function (e) {
e.preventDefault();
e.stopPropagation();
var mg = document.querySelector('#mg');
mg.classList.add('mg-show-info');
mg.dataset.memoryOverlayShowId = tile.dataset.id;
console.log("foo");
});
}