Answer the question
In order to leave comments, you need to log in
How to call a JavaScript function until the loop ends?
I have such a question while the cycle is running, then so many times you need to call the function.
{% for i in student_answers %}
.......
{% endfor %}
function plus_input() {
$('.many-group:last').after(
'<div class="form-group many-group">\
<label>' + label_input + '</label>\
<div class="input-group">\
<input type="text" class="form-control many-input" name="student_answer" pattern=' + pattern + ' required>\
<span class="input-group-btn">\
<button class="btn btn-danger" onclick="minus_input(event)" type="button">-</button>\
</span>\
</div>\
</div>');
}
{% for i in student_answers %}
<body onload="plus_input()"></body>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Python code is executed on the server side, and JS code is executed on the client side, i.e. in browser
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question