zepto trigger not work

229 Views Asked by At

I bind a click event for '.a' div

$('.a').on('click',()=>{
   //something
});

and another click event for '.b' to trigger '.a' click event:

$('.b').on('click',()=>{
   //something
   $('.a').trigger('click');
});

but trigger click does not work. if I trigger twice, it's work,like this:

 $('.b').on('click',()=>{
   //something
   $('.a').trigger('click');
   $('.a').trigger('click');
});

I don't know why, and how to fix it?

1

There are 1 best solutions below

1
stadnik0ff On

Try next code. Hope you use Jquery.

$('.a').click();