I want to set an elements position equal to the position of the cursor every one second. But as soon as i include the setTimout attribute in the function it stops working and prints the following error in the log: "Uncaught RangeError: Maximum call stack size exceeded".   

I have tried to run the code without a timeout but then the page freeze.   

Here is the code that i can't get to work:

---

```js
function moveElement() {
    while (true) {
        x = event.clientX;
        y = event.clientY;
        document.getElementById("status").innerHTML = x + " " + y; //This line is not important
        setTimeout(moveElement(), 1000);
        document.getElementById("test").style.color = "blue";
        document.getElementById("test").style.left = x + "px";
        document.getElementById("test").style.top = y + "px";
    }
};
```

Also i get this error when i try to run event.clientX outside a function: "Uncaught TypeError: Cannot read property 'clientX' of undefined"

Can somebody see what is wrong with my code or just tell me another method to get it to work (no jQuery please)? Thank you.

/HamMan4Ever