jquery .click being called multiple times

前端 未结 8 2242
小蘑菇
小蘑菇 2021-02-20 11:12

I am getting unexpected results with jQuery trying to set the \"click\" method of a div. Please see this jsfiddle. Be sure to open the console window. Click the word a few times

8条回答
  •  花落未央
    2021-02-20 11:30

    After your if, you're adding another click event to #test. It will call all click handlers when it's clicked. You probably don't need that at all since onclick is defined in the html.

提交回复
热议问题