• 27,004
  • +1,029
  • 3,074

Looping Element Using Jquery

Bookmark

Looping Element Using Jquery, after Googling for a long time (it takes about 12 hours) finally I find  that Jquery can looping the element on the Jquery object target. The Jquery library provides a method called each(), which will loop all of your element of the target. I find at this website about how to use this each() method. Below is the example :

// 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( intIndex ){
 
        // Bind the onclick event to simply alert the
        // iteration index value.
        $( this ).bind (
            "click",
            function(){
                alert( "Hottie index: " + intIndex );
            }
            );
 
    }
 
    );

Usually the above code can be used when you need to do some actions to find which anchor the user click…

Share this article if you found this post was useful:

Blogger at hacking-tutorial.com. Love PHP, offensive security and web. Contact him at me[-at-]vishnuvalentino.com

See all posts by || Visit Website : http://www.vishnuvalentino.com