I tried to disable a table by using JavaScript if two input values are equal.
My code:
<script type="text/javascript" charset="utf-8">
function checkEnableTable() {
var totalacceptedload = document.getElementById('totalacceptedload'),
var maximumload = document.getElementById('maximumload'),
tablecoursedistribution = document.getElementById('tablecoursedistribution');
tablecoursedistribution.disabled = (totalacceptedload.value = maximumload.value);
}
window.onload = checkEnableTable;
</script>
What am I doing wrong?
My Html
<input id="totalacceptedload" class ="alert alert-success" value ="<?php if (!isset($count_course_choice)):?><?php else: echo $count_course_choice['contact_hours'];?><?php endif ?>"/>
<input id="maximumload" class ="alert alert-danger" value ="<?php if (!isset($eee_setting)): ?><?php else:echo $eee_setting['maximum_course_choice'];?><?php endif ?>"/>
<table id="tablecoursedistribution" >
</table>