I've been attempting to adjust the z-Index using jQuery, but I want all DIVs except for one specific one called "importantdiv" to have a z-index ranging from 0 to 100. However, the issue is that importantdiv keeps getting assigned a z-index of 40 instead of the desired 510. Where did I go wrong in my jQuery code?
<script src="scripts/jquery-1.5.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var zIndexNumber = 100;
$('div').each(function() {
$(this).css('zIndex', zIndexNumber);
zIndexNumber -= 10;
});
$('#importantdiv').css('zIndex', 510);
});
</script>