JSFiddle - React, Tailwind, and code Playground
HTML
<div onclick="invis('one')" id="one"></div>
<button onclick="domove.mover()">hello</button>
<div onclick="invis('two')"id="two"></div>
<div onclick="invis('three')"id="three"></div>
<script type="text/javascript">
//Global variable to increment every function run
numberOfPixels = 10;
domove={
numberOfPixels : 10,
mover : function(){
$("one").style.left=numberOfPixels+'px';
this.numberOfPixels += 10;
setTimeout(domove.mover,20);
}
}
</script>
CSS
#one{width: 100px;
height: 50px;
float: left;
margin-right: 10px;
background-color: blue;
position: relative;}