Monday, October 1, 2012

jQuery wildcard with dropdown type selector


The jQuery wildcard with dropdown type selector is used to filter out all the dropdown elements in a page after applying the wildcard filters

select[attribute name='attribute value']


In this post we shall see on how to use the jQuery wildcard with dropdown type selector to select all the dropdown elements in a page after applying the wildcard filters

The following script lists out all the dropdown elements in a page which have a class attribute with value RedText

    $("select[class='RedText']").each(function() {
        alert('Wildcard - With dropdown Type:' + $(this).attr('id'));
    });

The following script lists out all the dropdown elements in a page which have a class attribute with value RedText on click of the btnWildcardSelector button.

$('#btnWildcardSelector).click(function(event) {
    event.preventDefault();               
    //
    // Wildcard - With dropdown Type
    $("select[class='RedText']").each(function() {
        alert('Wildcard - With dropdown Type:' + $(this).attr('id'));

Search Flipkart Products:
Flipkart.com

No comments: