Wednesday, 5 April 2017

How to Split 's every different variable

for example i have here my code, i want to split every different variable_name

I tried inserting ul inside the if statement but it wont work. is it possible to put ul without putting it outside the if?

lets say my variable_name = [dog,dog,dog,cat,cat,mouse,mouse,mouse,mouse];

and the output i want is

<ul>
  <li> dog </li>
  <li> dog </li>
  <li> dog </li>
</ul>
<ul>
  <li> cat </li>
  <li> cat </li>
</ul>
<ul>
  <li> mouse </li>
  <li> mouse </li>
  <li> mouse </li>
  <li> mouse </li>


Code:
<% for(var j=0;j<array4.length;j++)  { %>
<%  if(array4[j].input_type == "radio")      { %>

<li class="list-group-item radio-choice" id="chk_<%=array4[j].variable_name%>" value=""><%=array4[j].answer_text%> </li>

<%} }%>


via John Carlo Velasquez

No comments:

Post a Comment