.erb question

Hi,

I need to use a variable set in erb to give an element an ID...

For example:

In view...

      <% n = 1 %>

then

     <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

Dave

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>

Peace,
tiredpixel

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.)

Walter