move element left javascript code example

Example 1: javascript move element position

var moveX = 10
const x {
  if not == (obj==null) {
atrr.x = x.element //enter in the variable of your element inside "element"
  atrr.x = x.element + moveX }
}

Example 2: how to move a div to the right using a funvtion

window.addEventListener('click', function(e){
  if (document.getElementById("ClickBox").contains(e.target)) {
    var boxxy = document.getElementById("ClickBox");
    boxxy.style.left = (boxxy.offsetLeft + 50) + 'px';
  }
});