Return element with highest z-index

I’m using the jquery topZIndex plugin in my application. It’s working great.

Now I have a situation though, where I would like to return the element with the highest z-index on the page. The plugin has a function that will return the highest z-index, but it’s a value, not an object.

Any help is appreciated, thanks.

It looks like it’s going to be a different plugin that you need then.

You should be able to do it fairly easily without jQuery.


returns all the element objects on the page. Then loop through them to find the one with the highest z-index.

Shouldn’t be more than a handful of lines of code, max.