1

I've got some cards (forms) created with ng-angular based on Array list. On each card i have onClick event which doesn't trigger. If I copy paste the function code on browser console, all events work ! I guess that events aren't bind when the DOM is fully loaded.

These are my functions :

        $('.floating-open').on('click', function () {
        var $this = $(this);
        $this.parents('.clickable-button').addClass('clicked');
        $this.parents('.clickable-button').next('.layered-content').addClass('active');

        setTimeout(function () {
            $this.parents('.card-heading').css('overflow', 'hidden');
        }, 100);

    });

    $('.floating-close').on('click', function () {
        var $this = $(this);
        $this.parents('.layered-content').prev('.clickable-button').removeClass('clicked');
        $this.parents('.layered-content').removeClass('active');

        setTimeout(function () {
            $this.parents('.card-heading').css('overflow', 'initial');
        }, 600);

    });

Thanks in advance for your help

Michael Commons
  • 773
  • 2
  • 9
  • 28

1 Answers1

1

try to bind click event like below

$(document).on('click', '.floating-close', function(event) {

   //your code

}
Jekin Kalariya
  • 3,475
  • 2
  • 20
  • 32