:nth-of-type() pseudo-class pays attention only
to the element type. None of your "tab" elements are the first,
second, or third
<div> in their container, so
none match the selector.
You could, I think, do this:
You'd have to make sure that the
3 was updated when
you add/remove a tab of course.
Alternatively you could do this:
Then you'd just need to set up one handler.