jquery - How do I make my div IDs variable in rails? -


i feel there should simple way this, don't know is. have list of data display, , want include ajax "read more" function expand information @ bottom of each segment. this, need unique div ids within each segment. have code:

<% choice in @student_choices %>     <div id= "student_description", style="display:none;">         <%= choice[:description]%>     </div>     <%= link_to_function "read more", "element.show("student_description")"%> <% end %> 

but since there multiple div ids, clicking "read more" displays first one. how insert variable div id? know how in php, has me stumped. if div id variable, how element.show accept variable?

you can like:

<% div_id = "student_description_#{choice.id}" -%>  <div id="<%= div_id -%>", style="display:none;">     <%= choice.description %> </div>  <%= link_to_function "read more", "element.show('##{div_id}')" %>  

Comments

Popular posts from this blog

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

xslt - Umbraco and EXSLT sets do not work -