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 trialKarl Pupé
6,718 PointsI don't know what I am doing wrong but my code doesn't seem to work...
Hi! I am following along with the video and I feel that I have done everything that Aisha done and it doesn't work! I checked the console and nothing showing up! Here's my code:
// Adds a pet to the page with user on button click
$('#add-pet').on('click', function() {
// Grab info from the form
var $name = £('#pet-name').val();
var $species = £('#pet-species').val();
var $notes = £('#pet-notes').val();
//Assemble the HTML of our new element with the above variables
var $newPet = $(
'<section class="six columns"><div class="card"><p><strong>Name:</strong> ' + $name +
'</p><p><strong>Species:</strong> ' + $species +
'</p><p><strong>Notes:</strong> ' + $notes +
'</p><span class="close">×</span></div></section>'
);
// Attach the new element to the page
$('#posted-pets').append($newPet);
});
Thank you for all your help! I appreciate it!
1 Answer
andren
28,558 PointsWhile the pound has lost some value lately I wouldn't say its equal to the dollar just yet...
var $name = £('#pet-name').val();
var $species = £('#pet-species').val();
var $notes = £('#pet-notes').val();
Put in a less convoluted way you have mixed up $ and £ in your code. JQuery is not currency agnostic, only $ is accepted. If you fix those typos your code will probably work.
Karl Pupé
6,718 PointsKarl Pupé
6,718 PointsHehe! I think that Brexit screwed with my brain! Perfect! It got my code working!
Thank you so much!