jquery click event definitions

When using the selector defines in js jquery click event, like for example a plurality of element selected

<div class="tt">ccc</div>

<div class="tt">ddd</div>

<div class="tt">eee</div>

<div class="tt">fff</div>

At the same time define the click event of the four elements, you can directly write

$(".tt").click(function(){

  Method body;

})

Guess you like

Origin www.cnblogs.com/love-dream-88/p/11261485.html