Wednesday, October 3, 2012

jQuery hidden selector


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

$("input:hidden")

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

The following script lists out all the hidden elements in a page

    $("input:hidden").each(function() {
        alert('State - Hidden:' + $(this).attr('id'));
    });

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

$('#btnStateSelector).click(function(event) {
    event.preventDefault();               
    //
    // State - Hidden
    $("input:hidden").each(function() {
        alert('State - Hidden:' + $(this).attr('id'));
    });
});

Search Flipkart Products:
Flipkart.com

No comments: