Vova Potapov Vova Potapov - 1 year ago 268
jQuery Question

Get z-index of element in TinyMce (orchard)

I am using TinyMce4.I have some function that go all over my elements inside editor ,and appends to all elements new div ,AND to that DIV i need set z-index of that (parent)element.

i use draggable on all elements,and when i drag them i can see them one over the other,second element(2) over (3) ,(4) over (1),(2),(3).... than means that they have z-index value some where,but when i debug i cant find it

i used


it is return me empty string.

My code:

var editor = tinymce.activeEditor;
var ed_body = $(editor.getBody());
var ElementsArr = tinyMCE.activeEditor.dom.select(".draggableTemplate");
var el = ElementsArr[0];
var z = ElementsArr[0].style.zIndex;//z=''

In the css z-index is empty ,but when i drag it i can see that they behave like that do have it.

How i can get z-index of this elements,what other way to get it?

Answer Source

Try this:

$(ElementsArr[0]).css('z-index'); // jQuery way


getComputedStyle(ElementsArr[0]).zIndex; // js way
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download