Else statement not executed javascript

后端 未结 5 1606
执念已碎
执念已碎 2021-01-27 10:25

Hey Guys in the below code every time the if statement is executed no matter what the condition is.

function addRow(tableID) {

            var table = document.         


        
5条回答
  •  孤城傲影
    2021-01-27 11:05

    style.visibility = 'hidden' -> style.visibility == 'hidden'

    
    function addRow(tableID) {
    
       var table = document.getElementById(tableID);
       if((document.getElementById('select_degree').style.visibility == 'hidden') && (document.getElementById('select_degree')!=null)){
         document.getElementById('select_degree').style.visibility = 'visible';
         document.getElementById('select_ratings').style.visibility  = 'visible';
       }
    
       else{ 
         var rowCount = table.rows.length;
         var new_row = table.rows[rowCount-1];
         var row = table.insertRow(rowCount);                
         var colCount = table.rows[0].cells.length;
    
         for(var i=0; i

提交回复
热议问题