Bumble
Bumble

Reputation: 557

jquery selector help

Is it possible to use AND operator in jquery selector? My requirement is, I have a hidden input field inside an li tag. This li will be hidden based on some operation. In another button click I need to find out values of hidden input which are inside li and li tag style is not equal to hidden.

To do this i am doing

$(":input[class^=StoreID]").each(function (k) {
    if ($(this).parent().attr("style") != "display: none;") {
        storeID[k] = $(this).attr("value");
    }
});

Can this be modified in the selector itself?

$(":input[class^=StoreID]").parent().not('.hidden').each(function(k){.......etc});

Any suggestions?

Upvotes: 0

Views: 59

Answers (1)

alex
alex

Reputation: 490263

This should work...

$('li:visible :input[class^=StoreID]').attr("value");

Upvotes: 3

Related Questions