0

I'm trying to generate a select tag with multiple options using underscore.js. Is it possible to do something like this?

            <% for(i=1; i++; i <= 20) { %>
                <option value="<%= i %>"><%= i %>km</option>
            <% } %>

Because this does not work. Everything is in a script template tag.

4

1 回答 1

1

I think

<% for(i=1; i++; i <= 20) { %>

is wrong. Change it to

<% for(i=1; i <= 20; i++) { %>
于 2013-10-31T23:42:39.327 回答