I am running python with flask to render an html page. I have this html using JQuery: https://pastebin.com/SR66uc5J
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery164.js') }}"></script>
</head>
<body>
<h1>Hello! You are here, {{ email }} </h1>
<button><a href={{ '/protected_area' }}>Go Back</a></button>
<form id="form" action="{{ url_for("admin")}}" method="POST">
<ol>
{% for entry in allderos %}
<li>
<p>
entry0 {{ entry[0] }} , entry1 {{ entry[1] }} , entry2 {{ entry[2] }} ,
entry3 {{ entry[3] }} , entry4 {{ entry[4] }} , entry5 {{ entry[5] }} ,
entry6 {{ entry[6] }} , entry7 {{ entry[7] }} , entry8 {{ entry[8] }} ,
entry9 {{ entry[9] }} , entry10 {{ entry[10] }} ,entry11 {{ entry[11] }} ,
entry12 {{ entry[12] }}, entry 13 {{ entry[13] }}
<input type="text" name="hello" />
</p>
<p>
<input id="approvedCheck" type="checkbox" value={{ entry[13] }} name="approved"/>APPROVE
</p>
<p>
<input id="deniedCheck" type="checkbox" value={{ entry[13] }} name="denied"/>DENY
</p>
</li>
{% endfor %}
</ol>
<button type="submit" >Submit</button>
</form>
<script type="text/javascript">
$('#approvedCheck').change(function () {
if ($(this).attr("checked")) {
$('#deniedCheck').attr('disabled', true);
} else {
$('#deniedCheck').attr('disabled', false);
}
});
$('#deniedCheck').change(function () {
if ($(this).attr("checked")) {
$('#approvedCheck').attr('disabled', true);
} else {
$('#approvedCheck').attr('disabled', false);
}
});
</script>
</body>
</html>
I have N rows with 13 items each row. For each row, it shows an input text box and 2xinput checkbox
When i check one of the boxes, it disables the other.
The thing is that it works only for the first row, the java script does not work for the rest of the rows.
I feel like i am missing something, that something more should be added, but i cannot figure it out.
Can you help, please? Thank you