Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Bailey Hood
1,646 PointsHaving error message pop up when I'm using jQuery/JS code: ERR_FILE_NOT_FOUND
I can't seem to figure out why the 'photofullget' won't load the image I'm clicking in the jQuery event about it. When I take out this bit out of code: photoFull += "<img class= 'lightboxPhoto' src='" + photofullget + "'/>"; I don't get get that ERR_FILE_NOT_FOUND error message. Any ideas? Here's the full code:
$('.album-wrapper').on("click", "img", function (event) {
event.preventDefault();
console.log("Photo click is working!");
$ ('.lightbox-page').removeClass('inactive');
$ ('.album-page').addClass('inactive');
var selectedPhotos = ($(this).attr('src'));
console.log(selectedPhotos);
setPhotoFull(selectedPhotos);
});
var setPhotoFull = function (photofullget) {
var photoFull = "";
photoFull += "<div class ='lightbox-image-container'>";
photoFull += "<img class= 'lightboxPhoto' src='" + photofullget + "'/>";
photoFull += "</div>";
console.log(photoFull); return photoFull;
};
$('.lightbox-page').append(setPhotoFull);
1 Answer
Matthew Brock
16,791 PointsI believe your problem is that you are calling a function in
$('.lightbox-page').append(setPhotoFull);
instead of sending it content. try
$('.lightbox-page').append(setPhotoFull('your image file name '));