Skip to content

Instantly share code, notes, and snippets.

@sn00011
Forked from taxilian/example.jst
Created April 4, 2012 16:03
Show Gist options
  • Save sn00011/2303256 to your computer and use it in GitHub Desktop.
Save sn00011/2303256 to your computer and use it in GitHub Desktop.
example of a select statement in an underscore template
<select name="formitem_school">
<% if(schools && schools.length > 0) {
<option value="select_schools">Select School</option>
<% schools.each(function(t) { %>
<option value="<%= t.id %>" <% if(curSchool == t.id){ print('selected'); } %>><%= t.get("name") %></option>
<% });
} else { %>
<option value"schools_none">No Schools</option>
<% }
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment