Musicon Project - Handlebars Error

Link to project -

I believe something has gone wrong after following step 40 of 42. Once I had finished writing the handlebars template the next step was to delete the html code as the handlebars code would provide the information. But once I deleted the html code and refreshed the page everything disappeared and I can’t seem to find where I went wrong in the handlebars code for it not to show up. Below is my main.js code and my store.html code. If anyone can help it would be really appreciated.

main.js -

const context = {
title: ‘Welcome to Musicon’,
body: ‘Musicon is a budding musical storefront with a mission to share the joy of music. These magnificent auditory tools are designed with musical creators, like you, in mind. Hobbyists, beginners, and experts alike can appreciate the resplendent sounds supplied by each and every instrument we carry. Join us in delivering the euphoric vibrations of melodia to the citizens of the world!’,
instruments: [
image: ‘’,
name: ‘Electronic Keyboard’,
description: ‘A piano welcomed to the 21th century. Pianists celebrate the compact form factor and the diversity of synthesized rhythms all in one masterful musical machine.’,
price: ‘$1,999.00’,
sale: ‘$1,699.89’
image: ‘’,
name: ‘Electric Guitar’,
description: 'Join the legends of the '50s and ‘60s when the marriage of guitar and electricity created the most influential instrument of a generation. Note: picks sold separately.’,
price: ‘$599.99’
image: ‘’,
name: ‘Bass Guitar’,
description: ‘Experience the embodiment of funkadelic frequencies that is the bass guitar. Let the deep low notes of the bass guitar resonate with heartbeats everywhere.’,
price: ‘$624.99’
image: ‘’,
name: ‘Drum Kit’,
description: ‘Ever thought, “one instrument isn’t enough?” Find an answer in the drum kit. Coordinate a collections of drums and cymbals to dictate the rhythm of musical masterpiece.’,
price: ‘$649.00’,
sale: ‘$349.00’

const templateElement = document.getElementById(‘templateHB’);

const templateSource = templateElement.innerHTML;

const template = Handlebars.compile(templateSource);

const compiledHtml = template(context);

document.getElementById(‘information’).innerHTML = compiledHtml;

store.html -



      <ul class="navbar">
        <li class="current">
          <a href="index.html">Home</a>
          <a href="store.html">Store</a>
          <a href="contact.html">Contact</a>

<article id="showcase">
  <section id="information" class="container">

  <p>&copy; Musicon 2018</p>

<script src="public/main.js"></script>
1 Like

Hello David,

Can I kindly see your code from instruction 35 to 39 (the handlebars code)?.. Am thinking that’s where the problem might be.

Hello! Thank you for the reply, please see the code for steps 35-39 below.

{{#each instrument}}
    <article class="instrument">
      <img class="image" src="{{this.image}}" alt="{{}}">
      <section class="details">
        <h2 class="name">{{}}</h2>
        <p class="description">{{this.description}}</p>
        {{#if sale}}
        <p class="price"><del>{{this.price}}</del></p>
        <p class="sale">{{}}</p>
        <p class="price">{{this.price}}</p>

Hey David,

Sorry I have taken a while. I found the problem though.

So your class name in your element is “instrument” instead of “instruments”. I believe after you change this, your code will work just fine :slightly_smiling_face:

It should look like this:

<article class="instruments">

Oh and in the paragraph elements with class “price”…add Price: before the handbar expression so it looks like this:

<p class="price"><del>Price: {{this.price}}</del></p>

and in the else block:

<p class="price">Price: {{this.price}}</p>

Hope this helps! :slightly_smiling_face:

Hey Bwambura,

No need to apologise, sorry for my late response too haha. I will amend my code when I get home from work. Thank you for your help!!! :slight_smile:

Your welcome! :slightly_smiling_face:

Actually i also faced the same problem . however i understood how to use handlebars.js. though i couldnt solve it . i want discontinue and move forward. the class= instruments
solution didnt work though.