0
votes
 {%for i in range(0, maxct)%}
  <button  type="submit" name= "quesid" value="{{i}}" id="{{i+1}}" class="btn " onclick="checkButton(this.id)">{{i+1}}</button>
  {%endfor%}

I have a list called review i want to check if i is present in list then add class btn-primary or else add class btn-success how can i do it.

1
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. - Community

1 Answers

0
votes

Maybe something like this will work?

<button  type="submit" name= "quesid" value="{{i}}" id="{{i+1}}" class={{ 'btn-primary' if i in review else 'btn-success' }} onclick="checkButton(this.id)">{{i+1}}</button>