This is my javascript code
var helper = document.getElementById("helper");
helper.style.position = "relative";
helper.style.width = "50px";
helper.style.height = "50px";
helper.style.border = "1px solid #000";
function move() {
helper.style.left = event.offsetX + "px";
helper.style.top = event.offsetY + "px";
}
and my html code
<div id="grid" onmousemove="move()" onmousedown="down()">
<div id="helper"></div>
</div>
But when I call that function nothing happens. I want that variable helper to bi global and everything pre-initialized so I don't have to initialize everything all over again when function is called