Is there a way in jQuery to bring a div to front?

anthonypliu picture anthonypliu · Jul 13, 2010 · Viewed 71.6k times · Source

If I had a bunch of absolute positioned divs and they overlapped, how would I get a certain div to come to the front? Thanks again guys!

Answer

Kerry Jones picture Kerry Jones · Jul 13, 2010

This is a CSS thing, not a jQuery thing (though you can use jQuery to modify the css).

$('element').css('z-index', 9999);  // note: it appears 'zIndex' no longer works

Or, absolute positioning will bring something to the top:

$('element').css('position', 'absolute');