JSFiddle - React, Tailwind, and code Playground

by BradleyStaples

HTML

<table>
    <tr valign="top" class="">
    <td class="col-status status-yellow">&nbsp;</td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="Not Applicable" value="40" /></td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="Fixed" value="40" /></td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="OK" value="40" /></td>
    <td class="col-flag flag-red"><input name="ctl00" type="hidden" id="ctl00" value="True" /></td>
    <td class="col-question">8 (40).<a href="#" onclick="ChecklistNavigate('photos');return false;">link</a> <a href="#" onclick="showComments('40', 'ctl00');return false;">notes</a><input name="ctl00" type="hidden" id="ctl00" /></td>
</tr>

<tr valign="top" class="">
    <td class="col-status status-yellow">&nbsp;</td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="Not Applicable" value="380" /></td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="Fixed" value="380" /></td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="OK" value="380" /></td>
    <td class="col-flag flag-notset"><input name="ctl00" type="hidden" id="ctl00" value="True" /></td>
    <td class="col-question">23 (380).<a href="#" onclick="ChecklistNavigate('photos');return false;">link</a> <a href="#" onclick="showComments('380', 'ctl00');return false;">notes</a><input name="ctl00" type="hidden" id="ctl00" /></td>
</tr>

<tr valign="top" class="">
    <td class="col-status status-yellow">&nbsp;</td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="Not Applicable" value="20" /></td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="Fixed" value="20" /></td>
    <td class="col-chk"><input name="ctl00" type="checkbox" class="checklistitem" title="OK" value="20"...

JavaScript

var rejectQuestions = function(flagged, rejections) {

    
    var i = 0,
        flaggedLength = flagged.length,
        rejectionsLength = rejections.length,
        n = 0,
        questionNumber = null;
        flagged2 = nodeListToArray(flagged);
    
    for (i = 0; i < flaggedLength; i++) {
        questionNumber = flagged[i].previousSibling.previousSibling.querySelector('input').value;
        for (n = 0; n < rejectionsLength; n++) {
            if (rejections[n] === questionNumber) {
                flagged2.splice(i, 1);
            }
        }
    }
    
    return flagged2;
};

var nodeListToArray = function(nodeList){
	var arry = [],
        i = 0,
        len = nodeList.length;
	for (i = 0; i < len; i++) {
		arry.push(nodeList[i]);
	}
	return arry;
};

var flaggedQuestions = document.querySelectorAll('.flag-red'),
    rejections = ['40'],
    filteredQuestions = rejectQuestions(flaggedQuestions, rejections);

console.log(filteredQuestions);