Reputation: 2716
This might be the most trivial question but as far as I understand it seems to be correct but I'm unable to view the images as desired. The image shows the file structure and I'm trying to access these from jsGold.js file. It was working fine until I extracted certain files to a new project for cleanup hence I suspect the change in file path may have caused this issue.
Code lines in jsGold.js file:
else {
streamData.push(clickedId, streamName, streamDef);
var prop = $('<img class="prop" src="../../Images/prop.ico" />').attr('id', i);
newAgent.text(streamData[nameIndex]).append('<img class="cancel" src="../../Images/delete.ico"/>').append(prop);
The output that I'm getting is:
Desired Output:
Upvotes: 0
Views: 9008
Reputation: 2716
Thanks guys - the following works since I'm opening the file from work.html in views
var prop = $('<img class="prop" src="../Images/prop.ico" />').attr('id', i);
Upvotes: 0
Reputation: 4919
The relative path of you img
tag should be relative to the root of your website, not relative to the folder of your script.
You should use :
var prop = $('<img class="prop" src="/Images/prop.ico" />').attr('id', i);
If you open the page, from Views
, directly from your disk and not from a webserver, relative path must relative from the Views
folder. So you have to write it like this:
var prop = $('<img class="prop" src="../Images/prop.ico" />').attr('id', i);
Upvotes: 2