I want to create name of my class dynamically for this in for each loop i'm doing this. I am increment i for each for loop and using this i in class name. Here is my code.
<% int i=1;
for (Navigation.Element e: nav) {%>
<a href="#">
<%= e.hasChildren() ? "<i class=\"menu-icon menu-icon-"i++"\"></i>" : "" %> Link </a>
<%}%>
As i++ will not work because i is a variable need to be in between + + like +i+ i want to increment i and do this in single line.
Is it possible ?
Aucun commentaire:
Enregistrer un commentaire