To use CSS or JavaScript to prevent dragging of ghost image, we set the draggable attribute to false.
For instance, we write
<img id="myImage" src="https://picsum.photos/30/30" />
to add an img element.
Then we disable dragging on it with
document.getElementById("myImage").setAttribute("draggable", false);
We select the img element with getElementById.
And then we call setAttribute to set the draggable attribute to false to disable dragging.