lundi 17 mai 2021

Creating checkbox inside elements in a row

This is my function buildrow which is creating row inside the table, Inside it I am trying to create checkbox item for every column but I am just getting the text instead of column. How can I fix it. Basically I want checkbox inside every column in the created row

function buildrow(){
    
    var table = document.getElementById("data");
    var row = table.insertRow(-1);
    var l;
    var m;
    for (l = 0; l < id1.length; l++) {
        
        for(m=0; m < plans["data"].length; m++){
            if(plans["data"][m]["ID"]!==null){
            if(id1[l]==plans["data"][m]["ID"]){
            firstcol ='input type="checkbox" class="checks"><input type="checkbox" name="checkbox" value="checkbox" onchange="myFunction(event)"';
            
                var table = document.getElementById("data");
                var cell1 = row.insertCell(1);
                cell1.innerHTML=firstcol;
            }
            }
    
            }
    }
    }
tr:nth-child(2){
                background-color: #003a6a !important;
                border-top: none;
                height:30px
            }



Aucun commentaire:

Enregistrer un commentaire