/ Published in: jQuery
URL: http://www.bennadel.com/blog/534-The-Beauty-Of-The-jQuery-Each-Method.htm
FROM http://www.bennadel.com
Expand |
Embed | Plain Text
// Loop over each hottie. $( "#girls a.hottie" ).each( // For each hottie, run this code. The "indIndex" is the // loop iteration index on the current element. function( i ){ // Bind the onclick event to simply alert the // iteration index value. $( this ).bind ( "click", function(){ alert( "Hottie index: " + i ); } ); } );
You need to login to post a comment.
