Trying to establish a pathway to an image in my local storage using a setAttribute
approach seems to be resulting in an error indicating that the image cannot be found. Here is a snippet of the code I am working with:
if (shipLocation[0][0] == shipLocation[1][0] && i == 0) {
var x = document.createElement("IMG");
x.setAttribute("src", "../assets/patrolBoatHorizontalView.png"); // THIS IS THE PATH
}
Error
GET http://localhost:8081/assets/patrolBoatHorizontalView.png 404 (Not Found)
I am uncertain if this method of specifying the path is correct. I am using VisualStudio Editor and all my images are stored in the assets folder, and the request is being made from one of the components in this VueJS App.
Any suggestions or advice on this matter?