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 Introducing the Practice

Joseph Michelini
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Joseph Michelini
Python Development Techdegree Graduate 18,692 Points

Why can't I use .fadeIn() on the #newRestaurant text?

No matter where I seem to add .fadeIn(), whether it's inside the event handler, before .text, after .text, called on $('#newRestaurant') at the beginning or end of the handler, or even called on the event object, it doesn't seem to do anything. I was wondering where you'd need to add it for it to fade in the new review when the submit button was pushed.

Thank you!

1 Answer

Doron Geyer
seal-mask
.a{fill-rule:evenodd;}techdegree
Doron Geyer
Full Stack JavaScript Techdegree Student 13,897 Points

if you try it with the following it should work perfectly. Maybe try to compare your code to this.

$('#submitBtn').click(function(){
    let restaurantName= $("#restaurantNameInput").val();
    let review = $("#restaurantReviewInput").val();
  $("#newRestaurant h3").text(restaurantName);
  $("#newRestaurant p").text(review);
  $("#newRestaurant p").hide().fadeIn(2000);

I assume the problem you having is you are putting the fade in without first hiding the element like this

  $("#newRestaurant p").fadeIn(2000);

so if you set the code as per the exercise layout , you are already populating and providing the "p" tag with its inner text which means there is nothing to fade in. If you hide the content first and then fade it in it should work just fine.