Assign click handlers in for loop

前端 未结 6 2109
野的像风
野的像风 2020-11-22 03:21

I\'m having several div\'s #mydiv1, #mydiv2, #mydiv3, ... and want to assign click handlers to them:

$(document).ready         


        
6条回答
  •  有刺的猬
    2020-11-22 03:40

    To clarify, i is equal to 20 because the click event won't have fired until after the loop has finished.

提交回复
热议问题