Monday, October 1, 2012

jQuery wildcard all selector


The jQuery wildcard all selector is used to filter out all the elements in a page

$(“*”)


In this post we shall see on how to use the jQuery wildcard all selector to select all the elements in a page

The following script lists out all the elements in a page

    $("*").each(function() {
        alert('Wildcard - All:' +  $(this).attr('id'));
    });

The following script lists out all the elements in a page on click of the btnWildcardSelector button.

$('#btnWildcardSelector).click(function(event) {
    event.preventDefault();               
    //
    // Wildcard - All
    $("*").each(function() {
        alert('Wildcard - All:' +  $(this).attr('id'));
    });
});

Search Flipkart Products:
Flipkart.com

No comments: