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
  • 328
  • 6
  • 18
user254694
  • 1,261
  • 1
  • 19
  • 42

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,455
  • 1
  • 9
  • 11