0

I want to add 3 divs to my page. But before that I want to find the highest value of the z-index on the page and then add +1 to this value and add this new value to the css of these 3 divs. How can i do this in jQuery?

for example

<div id="one">
  <div id="two"></div>
  <div id="three"></div>
</div>

and the css

#one   {width:200px; z-index: +1 to the highest value found ;}
#two   {width:100px; z-index: +1 to the highest value found ;}
#three {width:50px; z-index: +1 to the highest value found ;}
SarmadK
  • 123
  • 1
  • 2
  • 14
  • 1
    you never want to mess with `z-index` in general. Most of the elements in a site shy away from using it unless it is a popup or something. Also if you want to find the `z-index` among all the elements in the page, there will be a lot of processing involved as you need to check every element. – Sushanth -- Aug 07 '13 at 04:05
  • You can use $(this).css("zIndex") to get z-index. and just add and apply zindex. – Butani Vijay Aug 07 '13 at 04:54

0 Answers0