There are two drop down boxes, when I select option 5 in first drop down then another drop down box should be disabled. While, drop down values are fetched from database.
<tr>
<td class="outside scrollable-menu"
style="border-style: none; border-bottom-style: none;">
Education<span
style="color: red;">*</span>
<form:select
path="educationBean.educationId" id="education"
class="form-control modalEdit">
<form:option hidden="hidden" value="">Education</form:option>
<c:forEach items="${educationList}" var="education">
<form:option value="${education.educationId}">${education.educationName}
</form:option>
</c:forEach>
</form:select>
</td>
<td class="outside scrollable-menu"
style="border-style: none; border-bottom-style: none;">
Degree<span
style="color: red;">*</span>
<form:select
path="degreeBean.degreeId" id="degree"
class="form-control modalEdit">
<form:option hidden="hidden" value="">Degree</form:option>
<c:forEach items="${degreeList}" var="degree">
<form:option value="${degree.degreeId}">${degree.degreeName}
</form:option>
</c:forEach>
</form:select>
</td>
</tr>
<script>
function disableDegree() {
if (document.getElementById("education").value === "5") {
document.getElementById("deg").disabled = "true";
} else {
document.getElementById("deg").disabled = "false";
}
}
</script>