jQuery '.each' and attaching '.click' event

后端 未结 2 1326
清酒与你
清酒与你 2020-12-12 23:35

I am not a programer but I enjoy building prototypes. All of my experience comes from actionScript2.

Here is my question. To simplify my code I would like to figure

2条回答
  •  时光取名叫无心
    2020-12-13 00:24

    No need to use .each. click already binds to all div occurrences.

    $('div').click(function(e) {
        ..    
    });
    

    See Demo

    Note: use hard binding such as .click to make sure dynamically loaded elements don't get bound.

提交回复
热议问题