I have this line to add a new element in the screen, but the absolute position is not working.
Javascript
function drawElement(e,name){
$("#canvas").append("<div id='" + name + "' class='element'"
+ "left="+e.pageX+" top=" + e.pageY +">"
+ name
+"</div>");
}
CSS
.element{
display:inline-block;
background:blue;
position:absolute;
}
What I doing wrong?
- List item
Update: from comment below (didn’t know you could do that!) 🙂