0

I have the following html

<div id="mydiv">HEllo</div>

the following css

#mydiv {
    z-index: 9999 !important;

}

using jquery 1.11.0

with this code

console.log(jQuery("#mydiv").css("z-index"));
jQuery("#mydiv").css({'z-index':'3000 !important'});

console.log(jQuery("#mydiv").css("z-index"));

why does it print 9999 twice?

Jsfiddle

rifa_at_so
  • 326
  • 1
  • 6
  • 18
user254694
  • 1,461
  • 2
  • 23
  • 46

1 Answers1

2

Are you doing this in document ready?

$(document).ready(function(){ 
  console.log(jQuery("#mydiv").css("z-index"));
  jQuery("#mydiv").css({'z-index':'3000 !important'});

  console.log(jQuery("#mydiv").css("z-index"));
});
Viktor Maksimov
  • 1,465
  • 1
  • 10
  • 11