jQuery trigger click gives “too much recursion”

前端 未结 2 1218
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-08 00:05

I\'m tryin\' to make the article\'s link clickable on the whole article space.

First, I did the hover thing, changing color on mouseover and so on... then on click i

2条回答
  •  执念已碎
    2021-02-08 00:47

    A cleaner way to solve this is to take the the element you are triggering the click on to and put it outside of the triggered element:

    So if you have this:

    
    
    
    
    

    By moving the "div.btn a" tag outside of the "boxContent" div. You avoid the recursion loop all together.

提交回复
热议问题