mardi 9 novembre 2021

Getting a checkbox from a table field

Good afternoon, below is the code in it I am getting fields from my table. The 0 field contains a checkbox, how can I find out if it is checked or not(true or false)? You need to change this line: console.log (td.item (f));

var table = document.getElementsByClassName("table-sm");
        for (var i = 0; i < table.length; i++) {
            var tr = table.item(i).getElementsByTagName("tr");
            for (var j = 0; j < tr.length; j++) {
                var trr = tr.item(j);
                    var td = tr.item(j).getElementsByTagName("td");
          
                for (var f = 0; f < td.length; f++) {
                    if (f === 0)
                        console.log(td.item(f));
                        console.log(td.item(f).innerText);

                }
            }



Aucun commentaire:

Enregistrer un commentaire