Posted By

dato on 02/25/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

espig


Uso de each()


 / Published in: jQuery
 

URL: http://www.bennadel.com/blog/534-The-Beauty-Of-The-jQuery-Each-Method.htm

FROM http://www.bennadel.com

  1. // Loop over each hottie.
  2. $( "#girls a.hottie" ).each(
  3.  
  4. // For each hottie, run this code. The "indIndex" is the
  5. // loop iteration index on the current element.
  6. function( i ){
  7.  
  8. // Bind the onclick event to simply alert the
  9. // iteration index value.
  10. $( this ).bind (
  11. "click",
  12. function(){
  13. alert( "Hottie index: " + i );
  14. }
  15. );
  16.  
  17. }
  18.  
  19. );

Report this snippet  

You need to login to post a comment.