I have a number of div elements with different z-index. And I want to find the highest z-index among these divs - how can I achieve it?
CSS:
#layer-1
This would do it:
$(document).ready(function() { var array = []; $("div").each(function() { array.push($(this).css("z-index")); }); var index_highest = Math.max.apply(Math, array); alert(index_highest); });
Try this