Thursday, October 4, 2012

jQuery even selector


The jQuery even selector is used to filter out the even elements in a page. 

$("input:even")

In this post we shall see on how to use the jQuery even selector to filter out all the even elements in a page.

The following script filters out all the even elements in a page

    $("input:even").each(function() {
        alert('Hierarchy - Even:' + $(this).attr('id'));
    });

The following script filters out the event elements in a page on click of the btnHierarchySelector button.

$('#btnHierarchySelector).click(function(event) {
    event.preventDefault();               
    //
    // Hierarchy - Even
    $("input:even").each(function() {
        alert('Hierarchy - Even:' + $(this).attr('id'));

Search Flipkart Products:
Flipkart.com

No comments: