简体   繁体   中英

jQuery on click event not working on a button but works well on other links

因此,我在电子商务站点上有一个购物车抽屉,每当单击“添加到购物车”按钮时,我都希望打开它。

I can't comment yet, however, i think your button may not be firing because of duplicate id fields. id 's are considered unique to one element while class 's can be applied across many elements. Your javascript ('#AddToCart') will only run on the first element with that specific id . Check your code just to be sure.

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