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

Swan The Human
seal-mask
.a{fill-rule:evenodd;}techdegree
Swan The Human
Full Stack JavaScript Techdegree Student 19,338 Points

For the last step I have the exact same code and when i hit submit nothing shows up

$('#submitBtn').click(function(){
//  a. Use the val() method to get what's been entered into the restaurant name and restaurant review form input fields. Save both values to variables.
//  b. Insert the restaurant name value into the #newRestaurant h3 tag 
//  c. Insert the restaurant review value into the #newRestaurant paragraph tag
    const rName = $('restaurantNameInput').val();
    const rReview = $('restaurantReviewInput').val();
    $('#newRestaurant h3').text(rName);
    $('#newRestaurant p').text(rReview);


});
Luis Villalobos
Luis Villalobos
7,831 Points

Hey Sean, your code looks good as far as I can tell. Can you post the HTML as well? The issue might lie in the attributes. Check and see if restaurantNameInput and restaurantReviewInput are actually IDs. If so, make sure to include a # in your query selectors.

1 Answer

Luis Villalobos
Luis Villalobos
7,831 Points

Sorry after having a better look, all you have to do is remove the element tags within your selectors. The h3 and p tags within your code are unnecessary as IDs are unique and you'd only be targeting those tags anyway. Remove those and your code should work. If not post the HTML and I'll have a better look. Good luck!