I need to use a variable set in erb to give an element an ID...
<% n = 1 %>
<span id= "<% n %>" ><%= picture.title %></span>
...can't figure out how to set the ID of the span element above.
Any help would be appreciated
In ERB, `<%` denotes code, the 'result' of which doesn't get inserted,
and `<%=` denotes code, the 'result' of which does get inserted. Thus,
I expect you're finding that the `picture.title` gets inserted, but
the `n` doesn't. Try changing the line to something like:
<span id= "<%= n %>" ><%= picture.title %></span>
And, of course you know this, the first character of an ID cannot be numeric in HTML. (It must begin with an alpha character or an underscore.)