.closet() with paramters

.closet() with paramters

I need a code to get the closet h1 element that not hidden (display != none), how can I do it and I prefer without foreach.

thx, red7711.