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 trialVic Mercier
3,276 PointsPutting code at the bottom of the file doesn't work and under the line where I appended the newpet to the div, it works?
I would like to know why.
1 Answer
Cedric Hoppe
3,908 Pointsyea I struggled with the same problem until i figured it out
so this works
// Attach the new element to the page
$('#posted-pets').append($newPet);
$('.close').on('click', function () {
$(this).parent().remove();
});
// Reset form fields
$name.val("");
$species.val("Dog");
$notes.val("");
});
// Puppy images fade in
$('img').css('display', 'none').fadeIn(1600);
$('.card').on('click', function() {
$(this).toggleClass('selected');
});
but this doesnt work
// Attach the new element to the page
$('#posted-pets').append($newPet);
// Reset form fields
$name.val("");
$species.val("Dog");
$notes.val("");
});
// Puppy images fade in
$('img').css('display', 'none').fadeIn(1600);
$('.card').on('click', function() {
$(this).toggleClass('selected');
});
$('.close').on('click', function () {
$(this).parent().remove();
});
no idea why tho
Charles Kenney
15,604 PointsCharles Kenney
15,604 PointsVic, it's kind of hard to understand what you're talking about without seeing the code you have submitted. Do you mind updating your question with your code submission so we can better assist you?