How to get data for the next and previous index in the for loop in hubl for setting conditions?
SOLVE
Hi there,
I'm trying to set conditions in Hubl under for loop for the repeated fields. You can see my code below under the script tag where I'm using different values:
<script> function showVal(newVal){ if(newVal <= {{ module.free_slab_limit }}){ jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("{{free_text.freeText}}"); jQuery(".workspace_members span").text(newVal); } {% for item in module.step_fields %} else if( newVal>= {{item.step_value}} && (Here I need to use the condition for next and previous index)){ jQuery(".workspace_members span").text("{{ item.step_text }}"); } {% endfor %} else{ jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("$" + (newVal*{{ module.per_user_cost }})); jQuery(".workspace_members span").text(newVal); } } </script>