I am creating divs dynamically and would want them added to the parent div in random positions not in the last position e.g.
var opt = document.createElement("div");
var txt = document.createTextNode(str);
opt.appendChild(txt);
//get the top and left positioning of the elements
var x = Math.floor(Math.random() * (400));
var y = Math.floor(Math.random() * (50));
opt.style.top = y + "px";
opt.style.left = x + "px";
opt.style.zIndex = zindex;
$("#parentDiv").append(opt);
But problem is jquery's append function or add function puts the div in the last position on the stack. i want it put randomly between other divs...help