selector doesn't exist yet

PHOTO EMBED

Thu Dec 23 2021 16:33:58 GMT+0000 (Coordinated Universal Time)

Saved by @mmerkley #html

// Normal Event 
$("#dataTable tbody tr").on("click", function() {
    console.log($(this).text());
});

// Delegate event to "#dataTable tbody" since "tr" elements don't exist yet
$("#dataTable tbody").on("click", "tr", function() {
    console.log($(this).text());
});

// Delegate event to "document" since "#.bar.desktop" element does not exist yet
$(document).on("click", ".bar.desktop", function() {
    $(this).toggleClass('open');
});
content_copyCOPY