• Uncaught TypeError: Cannot read properties of null (reading 'querySelector')

    ?

    See screenshot below ??

    ?

    edited code ??

    const wrapper = document.querySelector("#ash-dragable-hook-panel");
    if (wrapper) {
      const header = wrapper.querySelector(".ash-show-move-window");
    
      function onDrag({movementX, movementY}){
        let getStyle = window.getComputedStyle(wrapper);
        let leftVal = parseInt(getStyle.left);
        let topVal = parseInt(getStyle.top);
        wrapper.style.left = ${leftVal + movementX}px;
        wrapper.style.top = ${topVal + movementY}px;
      }
    
      header.addEventListener("mousedown", ()=>{
        header.classList.add("ash_active");
        header.addEventListener("mousemove", onDrag);
      });
    
      document.addEventListener("mouseup", ()=>{
        header.classList.remove("ash_active");
        header.removeEventListener("mousemove", onDrag);
      });
    }
  • The topic ‘Main JS error’ is closed to new replies.