Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  117] [ 7]  / answers: 1 / hits: 25543  / 11 Years ago, fri, april 26, 2013, 12:00:00

I am getting a SyntaxError: Unexpected EOF output when using an underscore template to render html in a Backbone application. Here is my template:-



<script type=text/template id=shellmenu-template>
<div>
<p>menu template html will go here....</p>
<div class=menuButtonsContainer>
<% _.each(menu, function(menuItem){ %>
<button class=menuButton id=<%= _.escape(menuItem.id)><%= _.escape(menuItem.title) %></button>
<% }); %>
</div>
</div>
</script>


It is specifically erroring on this part:-



id=<%= _.escape(menuItem.id)


The id attribute is a number, here is the menuItem object:-



dataPath: 
helpType: default
id: 0
moduleName: TestModule
modulePath: interaction/test/testmodule
title: Test Module Interaction


I have tried making the id a string or making it the title attribute in the underscore template code just to see if I can get a test case working in any shape or form but I am stumped so far. I have a similar template doing pretty much the same thing with no errors.



Any ideas what silliness I am engaging in to cause this? :-)


More From » html

 Answers
18

Looks like you didn't close <%= with %>


[#78602] Thursday, April 25, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lesli

Total Points: 348
Total Questions: 105
Total Answers: 119

Location: United States Minor Outlying Island
Member since Fri, Jan 6, 2023
1 Year ago
;