본문 바로가기

개발

[jQuery] table td show/hide

function tableColShow(tableId, idx, showFlag){
       if( showFlag == true){
            $( "#" + tableId +" col:nth-child(" + idx +")").show();
            $( "#" + tableId +" th:nth-child(" + idx +")").show();
            $( "#" + tableId +" td:nth-child(" + idx +")").show();
      } else{
            $( "#" + tableId +" col:nth-child(" + idx +")").hide();
            $( "#" + tableId +" th:nth-child(" + idx +")").hide();
            $( "#" + tableId +" td:nth-child(" + idx +")").hide();
      }
}

tableColShow( "etcListTbl" , 3 , true);