Strange behavior of disabled property for table element

23 Views Asked by At

So this is small wrapped up HTML element in one of the .aspx pages served on a website.

<table id="ucDemographics_tdDemographic" style="width: 100%; height: 100%" cellspacing="0" cellpadding="3">
  <tbody> 
    <!--   inner html code removed for readability purspose  -->
  </tbody>
</table>

One of the js functions is trying to access this element by id and do perform some logic:

function Validate() {
  
    // dropdown for physican name
    var physicVal = document.getElementById('ucDemographics_uxddlPhysicianName').value; 
  
    // Empty physicianName validation
    if (physicVal == "-1") {
        window.alert('Validation(s) failed');
        physicVal.focus();
        return false;
    }

    // Empty nurseName validation
    var tablebyID = document.getElementById('ucDemographics_tdDemographic');
    if (tablebyID.disabled == false) {
      
        // dropdown for nurse name
        var nurseVal = $("#ucDemographics_uxGENurse").val() ;
      
        if ( nurseVal == "-1") {
            window.alert('Validation(s) failed');
            nurseVal.focus();
            return false;
        }
    }
  
  return true;
}

My question is how this code segment in above Validate function able to access the disabled property, since it's selecting a table tag and they don't support disabled property as far as my understanding goes.

var tablebyID = document.getElementById('ucDemographics_tdDemographic');
if (tablebyID.disabled == false) {  }

Here is a snapshot of my chrome debugger:

enter image description here



Edit 01: The Validate function is called upon when onClick() event triggers on the submit button.

0

There are 0 best solutions below