简体   繁体   中英

onclick event jquery+angular trigger click event 3 times

I am using Jquery + Onsen UI which uses Angular. I can't get de element event click using

$(element).click(function(){});

Then I am using this way

  $(".list").on("click",".item-from-list",function(){

Ok, now it works. The problem is: The list is inside an ons-carousel that has 3 slides with 3 different lists, but with the same class that I want to get click.

When I click in some list item, It triggers the click event 3 times. What should I do?

Thanks.

Have you tried looking at event.stopPropagation()?

Description : Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.

https://api.jquery.com/event.stoppropagation/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM