jQuery имеет :visible
селектор для нас.
function (jQelem1) {
jQelem1.filter(':visible').each(function() { doSomething(); });
}
Чтобы проверить наличие каких-либо других свойств с видимостью
Предположим:
// check for presence of id
function (jQelem1) {
jQelem1.filter(':visible[id]').each(function() { doSomething(); });
}
// check for presence of class
function (jQelem1) {
jQelem1.filter(':visible[class]').each(function() { doSomething(); });
}
// check for both presence of id and class
function (jQelem1) {
jQelem1.filter(':visible[id][class]').each(function() { doSomething(); });
}
// check for both presence id = foo
function (jQelem1) {
jQelem1.filter(':visible[id="foo"]').each(function() { doSomething(); });
}
// check for both presence id = foo and class=bar
function (jQelem1) {
jQelem1.filter(':visible[id="foo"][class="bar"]').each(function() { doSomething(); });
}
И многое другое. Читайте перевод информации о jQuery selectors clearly.