0

I'm with a issue, the element $("#el") doesn't exist when I running my JS. The element has on different HTML but is on the same page.

I'm already try

$("#el").ready(addClickEv());

$(document).ready(addClickEv);

$.when($("#el").length > 0).then(addClickEv());

function addClickEv() {
    $("#el").on("click", function() {
        console.log("click");
    });
}

But any of this works. How can I do this?

Rory McCrossan
  • 306,214
  • 37
  • 269
  • 303
gFontaniva
  • 815
  • 10
  • 24

0 Answers0