I have container with class .headerRightZone
this container has elements with class .btn
some of them has class .hidden
Goal: I need to choose (write selector) the last visible (button without .hidden class) button
myhtml.html
<div class="headerRightZone">
<a href="javascript: void(0)" class="btn">Button 1</a>
<a href="javascript: void(0)" class="btn">Button 2</a>
<a href="javascript: void(0)" class="btn">Button 3</a>
<a href="javascript: void(0)" class="btn hidden">Button 4</a>
<a href="javascript: void(0)" class="btn hidden">Button 5</a>
</div>
mycss.css
.hidden{
display: none;
}
.btn{
background-color: #fff;
}
.headerRightZone .btn:not(.hidden):last-of-type{
background-color: #f00;
}
I wrote:
.headerRightZone .btn:not(.hidden):last-of-type
But it returns an empty array.
Attached jsFiddle Example
What's wrong in the code? Why the array is empty?