Can you change z-index from JS in IE8
A very simple example: http://jsbin.com/ohude
Press button1, the text "hello2" p should change the z-index to 89. Press button2, the z index should change again. This is obvious in firebug. But it doesn't jack in IE8.
Can anyone confirm?
Thanks.
I don't have IE8 and I don't know the jQuery code.
Have you tried changing the viewable text or just the z-index? If the z-index AND the text being viewed, it was not in Safari.
For my test, I changed your original jQuery styled functions to:
- warning about your initial change (note that style.zIndex, not z-index); and
- then changed the text nodeValue to reflect the change in z-index.
First I change your css to css ('zIndex', '89') to see if that changed the results. Anyway, css ('zIndex' ...) or css ('z-index' ...) worked for me.
As I said, I don't know jQuery. But after testing the following snippet in IE8, if it doesn't work, try changing the css arg to "zIndex", just for fun.
TEST:
$('#click').click(function () {
$('#hello').css('z-index','89');
var pid = document.getElementById('hello');
alert('pid.style.zIndex: ' + pid.style.zIndex);
pid.firstChild.nodeValue = "Hello2 " + pid.style.zIndex;
});
$('#click2').click(function () {
$('#hello').css('z-index','10');
var pid = document.getElementById('hello');
alert('pid.style.zIndex: ' + pid.style.zIndex);
pid.firstChild.nodeValue = "Hello2 " + pid.style.zIndex;
});
});
Sorry to mess up the JQuery code .: D
a source to share