Assign click handlers in for loop

前端 未结 6 2117
野的像风
野的像风 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:44

    Generally, if you are looking to assign click handles to a large number of items, you want to have a container (higher level div) that interprets the clicks for you, as the click bubbles up from the dom.

    ...
提交回复
热议问题