Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Roudy Antenor
4,124 Pointsphotos show up BUT all disorganized?
Hello all here is my code - i opted to not use the variables and code the $.getJSON with my demands however -- i have the same code as video by photos show up with none of the styling -- any thoughts??
$(document).ready(function(){
$('button').click(function(){
$('button').removeClass('selected');
$(this).addClass('selected');
let animal = $(this).text(); //get text from html elem.
$.getJSON('https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?',
{
tags: animal,
format: "json"
},
function(data){
let photoHTML = '<ul>';
$.each(data.items, function(i, photo) {
photoHTML += '<li class="grid-25 tablet-grid-50">';
photoHTML += '<a href="' + photo.link + '" class=image">';
photoHTML += '<img src="'+ photo.media.m + '"></a></li>';
}); //end each
photoHTML += '</ul>';
$('#photos').html(photoHTML);
} //end callback function
); //end .getJSON
});// end click event handler
}); //end ready
1 Answer

Charles Wanjohi
9,235 PointsThe error is in this statement
photoHTML += '<a href="' + photo.link + '" class="image">';
// ensure the class=image " has the "image" value enclosed in quotes
Hope this helps you out
Roudy Antenor
4,124 PointsRoudy Antenor
4,124 PointsAhhhhh .... It works! Many Thanks!