JavaScript only works in the first iteration and does not affect the fields from the second iteration.
Sample Code Using forloop
{% for i in userlist %}
<input id="a" type="email" value="{{i.email}}">
<input id="b" type="text" value="{{i.date_of_birth}}">
<input id="c" type="text" value="{{i.mobile}}">
{% endfor %}
Button to Disable Editing
<button onclick="disableProfileEditing()" type="button"> Disable </button>
Button to Enable Editing
<button onclick="enableProfileEditing()"> Edit</button>
JavaScript Functions
function disableProfileEditing() {
document.getElementById(a).disabled = true;
document.getElementById(b).disabled = true;
document.getElementById(c).disabled = true;
}
function enableProfileEditing() {
document.getElementById(a).disabled = false;
document.getElementById(b).disabled = false;
document.getElementById(c).disabled = false;
}