简体   繁体   中英

How Select Table Row

How Select table row based on table header and First Column Values. Can you please help me this Using JavaScript or jQuery . Please find the attache image在此处输入图片说明for your reference.

   $(document).ready(function () {
        var json = {1: 'AOC', 2: 'BAs', 3: 'CTS:ELE', 4: 'COE:DEV'};
        $('table#xss tr').each(function () {
            var type = $(this).find('td:nth-child(2)').text();
            var res = type.split(";");
            var thisRow = $(this);
            $.each(json, function (key, val) {
                for (var i = 0; i < res.length; i++) {
                    if (val == res[i].trim()) {
                        var cc = parseInt(key) + 2;
                        thisRow.find('td:nth-child(' + cc + ')').html('****')
                    }
                }
//            
            });
        });
    });

更改第 1 行第 5 列的内容:

$("#box tr:nth-child(1) td:nth-child(5)").html("hehe");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM