JasperTack
JasperTack

Reputation: 4447

put div on top of ace editor

I am using an ace editor instance in my webpage:

<div class="tabpage" id="tabscontent">
     <div class="ace_page" id="tabpage_1">
     </div>
</div>  

and my javascript file initializes this div as an ace editor instance:

var aceEditor = ace.edit("tabpage_1");
aceEditor.setTheme("ace/theme/textmate");
aceEditor.getSession().setMode(language);

Now I would like to put div in the tabpage_1 so that this will be on top of the editor instance using this code:

function addUserCursor(editor, position, user, color) {
var page = document.getElementById("tabscontent");
var label = document.createElement("div");
label.setAttribute("id", editor+"-"+user);
label.setAttribute("position", "absolute");
label.setAttribute("top", "200px");
label.setAttribute("left", "200px");
label.setAttribute("background-color", color);
label.setAttribute("z-index", "10");
label.innerHTML = user;
page.appendChild(label);

}

But this doesn't result in a div that is on top of that editor(the styleattributes will be collected in a css later, this is only for testing). Does anybody know what I am doing wrong?

Upvotes: 0

Views: 1496

Answers (1)

a user
a user

Reputation: 24139

label.setAttribute("z-index", "10"); is wrong it must be label.style.zIndex = 10;

Upvotes: 1

Related Questions