I use Handlebars to load HTML content from a javascript file. Here is the code that puts text into an HTML div.
var mainInfo = "{{{header}}} {{{describtion}}} {{{sentence3}}}"; var template = Handlebars.compile(mainInfo); var data = template({ header: "<h1>Powerful business</h1>", describtion: '<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit.Donec turpis neque, sodales a faucibus at, viverra luctus urna. Suspendisse dignissim neque dui, in tincidunt arcu.</p>' }); document.getElementById ("maintext").innerHTML += data;
But when I duplicate the same code with different variable names, in order to load content to other areas of the web page, everything stops working.
By experience, I realized that it is still possible to create a new variable, but it is worth assigning an expression to it handlebars, for example:
var cerviceContent = "{{newheader}}} {{{content}}};
And the text disappears from everywhere. Why and how to fix it?
var cerviceContent = "{{{newheader}}} {{{content}}}";
the code is not parsed due to a missing opening brace and a closing quote - Igor