Click handling function is not initiated

JS fiddle:

let album_images_slider = new Swiper("#album_images_slider", {
    direction: "horizontal",
    slidesPerView: 1,
    loop: true,
    allowTouchMove: false,
    speed: 600,
    autoplay: {
        delay: 3000

    navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev"

$(function() {

    $("#album_images_slider").click(function(e) {
        console.log("hello, mate!");
        if ("swiper-slide")) {
            $("body *").hide();
            $("body").before(`<div class="layer">Hey!</div>`);
    $(".layer").on("click", function() {

Block .layer is succesfully displayed on the screen, but for some reason when I click on .layer, .layer click handling isn’t invoked.

What is the problem? And how can I solve that?

Any help would be highly appreciated!

57 thoughts on “Click handling function is not initiated”

  1. What i don’t understood is actually how you’re now not actually a lot more
    neatly-liked than you might be right now. You are very intelligent.
    You already know therefore significantly in the case of this
    subject, produced me for my part consider it from so many various
    angles. Its like men and women aren’t interested until it’s something to
    accomplish with Woman gaga! Your own stuffs excellent.
    At all times take care of it up!


Leave a Comment