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

JavaScript Introduction to jQuery DOM Manipulation Adding Content to the Page

Briain Corroon
Briain Corroon
13,689 Points

Course code is incomplete

The course code provided in the teacher's notes does not match the code which the instructor pastes into her code.

I find it bizarre that the instructor would provide code which will not work without changes and does not alert us to this. The val() is also explained at no point in this video.

This is the code provided:

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">&times;</span></div></section>'  
);

This is the correct code:

var $newPet = $(
   '<section class="six columns"><div class="card"><p><strong>Name:</strong> ' + $name.val() + 
   '</p><p><strong>Species:</strong> ' + $species.val() +  
   '</p><p><strong>Notes:</strong> ' + $notes.val() + 
   '</p><span class="close">&times;</span></div></section>'  
);
Danny Burns
Danny Burns
Courses Plus Student 8,780 Points

I noticed the same thing, but I just instinctively added the .val() while I was typing it all out. Have you sent this to support? I'm finding this particular course a bit hard to follow along. The instructor's instructions seem a bit out of sync with what is being shown on screen or in the notes, or as you mentioned, completely non-existent.

Briain Corroon
Briain Corroon
13,689 Points

I haven't sent it to support but I suppose I should. I just wanted to post this to alert other students if they are having problem getting the code to work.