Я хотел сделать атрибут disabled отключенным, но он не работает. вот мой код вот моя база. html
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="{% static 'css/duty.css' %}">
<script src="{% static 'js/duty.js' %}"></script>
<title></title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
вот мой долг. html
{% extends 'base.html' %}
{% block content %}
<h1>duties and details for TA</h1>
<p>#student:{{ course.capacity }}</p>
<form>
<table border="2" bordercolor="black" width="800" height="500" cellspacing="0" cellpadding="5">
<tr>
<th>classification</th>
<th>times</th>
<th>teaching activity</th>
<th>Approx. hours/student</th>
</tr>
<tr>
<td rowspan="3">Lab</td>
<td rowspan="3"><label><input class="duty" type="text" disabled="disabled" value="{{ taDuty.labNumber }}"></label>
</td>
<td>preparation</td>
<td><label><input class="duty" type="text" disabled="disabled" value="{{ taDuty.preparationHour }}"></label></td>
</tr>
</table>
<button onclick="modification()">modify</button>
<button type="submit">save</button>
</form>
{% endblock %}
вот мой долг. js
function modification() {
let node = document.getElementsByClassName('duty');
for (let i = 0; i < node.length; i++) {
node[i].disabled = false;
}
}
Моя javascript функция может быть вызвана. Я попытался добавить alert (), и это работает, но атрибут атрибута disabled не может быть установлен в false. Я не знаю почему. Спасибо за любую помощь!