FAQ: Learn Handlebars - Handlebars "If" block helper

This community-built FAQ covers the “Handlebars “If” block helper” exercise from the lesson “Learn Handlebars”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Building Interactive JavaScript Websites

FAQs on the exercise Handlebars “If” block helper

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I need help with this. The console keeps returning an error. can anyone help me check for any mistakes cos I don’t seem to see any in my code. I did exactly what the instructions asked me to do
https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/templating-with-handlebars/lessons/learn-handlebars/exercises/handlebars-if

 <script id="ifHelper" type="text/x-handlebars-template">
    {{#if opinion}}
    	<p>
      	The correct way to say 'GIF' is GIF!
      </p>
    {{/if}}
    </script>   

The instruction:
Inside the {{if}} block, add an opening and closing <p> tag. Inside the created <p> add in the text: "The correct way to say 'GIF' is GIF!" .

This template will now include a <p> element that says "The correct way to say 'GIF' is GIF!" if opinion is truthy.

Hello, sorry I’m a bit late, but did you try putting the paragraph sentence inside speechmarks? I put it in single speechmarks and then the first GIF in double marks and it seems to be working.
Hope you already resolved it, though :slight_smile:

Use “” around the paragraph" so:
{{#if opinion}}

“The correct way to say ‘GIF’ is GIF!”


{{/if}}

I tried to backslash the ‘GIF’ and it didn’t work either. Hope this helps!

Lauren