I've got two lists on a page. I want to hide items in one list when items of the same name (text) are found on a second list. I can create the arrays ok but having difficulty understanding how to use the [i] value as a variable when comparing the two arrays.
The value "Application to Use Radioactive Materials" is in both arrays but my code cannot discern it. I want to hide the tr for "Application to Use Radioactive Materials" on List one because it is a hidden block of text on List two. But the return I'm getting is all items in the second list array (the 'hidden' items) rather than just a single item.
it's this section here that doesn't work for me. could someone please have a look. i'm stuck:
// SHOW HIDE IRB CHECKLIST
$(document).ready(function () {
var newArr = [];
var xtext = $("i");
$(xtext).each(function (index) {
newArr.push($(this).text())
});
alert("CHECKLIST ARRAY==== " + newArr);
if (jQuery.inArray("Other IRB Site", newArr) != -1) {
// alert("jjjj");
}
var newArr3 = []
var newArr4 = []
var xtext3 = $("A");
var xParent = $("xtext3").parent().parent().parent()
$(xtext3).each(function (index) {
//WHY DOESN'T THIS CONDITION WORK
if ($(this).parent().parent().parent().attr('style') == 'DISPLAY: none') {
newArr3.push($(this).text());
newArr4.push($(this).parent().parent().parent().attr('style'));
}
});
alert("HIDDEN DOCUMENT ARRAY==== " + newArr3)
for (var i=0; i < newArr3.length; i++) {
if(jQuery.inArray(i, newArr) >=1) {
$("#tuke").append("INARRAY " + newArr3[i]);
$("p:contains('i')").parent().parent().hide();
} else {
$("#tuke").append("wNOT IN ARRAY xxxxx: " + newArr3[i]);
}
}
<div id="tuke"></div>
<div class=WordSection1>
<div align=left>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=542 style='width:406.5pt;border-collapse:collapse'>
<tr>
<td valign=bottom style='border:solid #BFBFBF 1.0pt;border-bottom:none;
background:white;padding:24.0pt 16.5pt 10.5pt 16.5pt'></td>
</tr>
<tr>
<td valign=top style='border:solid #BFBFBF 1.0pt;border-top:none;background:
white;padding:0in 0in 0in 0in'>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=540 style='width:405.0pt;border-collapse:collapse'>
<tr>
<td colspan=2 style='border:none;border-bottom:solid #A6C2B2 1.0pt;
padding:3.0pt 16.5pt 3.0pt 16.5pt'>
<p class=MsoNormal align=left style='margin-bottom:0in;margin-bottom:
.0001pt;text-align:left;line-height:normal'><span style='font-size:12.0pt;
color:#354D3F;text-transform:uppercase'>Submission checklist for irb
studies that enroll subjects</span>
</p>
</td>
</tr>
<tr>
<td valign=top style='padding:3.0pt 3.75pt 3.0pt 16.5pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;
line-height:normal'><i><span style='font-size:10.0pt;color:#262626'>QUESTION</span></i>
</td>
<td valign=top style='padding:3.0pt 16.5pt 3.0pt 3.75pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;
line-height:normal'><i><span style='font-size:10.0pt;color:#262626'>INSTRUCTIONS</span></i>
</p>
</td>
</tr>
<tr>
<td valign=top style='padding:3.0pt 3.75pt 3.0pt 16.5pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;
line-height:normal'><i><span style='font-size:10.0pt;color:#262626'>Application to Use Radioactive Material</span></i>
</p>
</td>
<td valign=top style='padding:3.0pt 16.5pt 3.0pt 3.75pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;
line-height:normal'><span style='font-size:10.0pt;color:black'>Upload
approval from other site or include a cover letter with an explanation that
you need VABHS IRB approval prior to seeking approval from other IRBs.</span>
</p>
</td>
</tr>
<tr>
<td valign=top style='padding:3.0pt 3.75pt 3.0pt 16.5pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;
line-height:normal'><i><span style='font-size:10.0pt;color:#262626'>Abstract</span></i>
</p>
</td>
<td valign=top style='padding:3.0pt 16.5pt 3.0pt 3.75pt'>
<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;
line-height:normal'><span style='font-size:10.0pt;color:black'>Upload the
following: IND Certificate, FDA or sponsor letter, product information,
e.g. Investigational Brochure, etc., written assurance form the sponsor
that the manufacture and formulation of the investigational or unlicensed
test article being used in the research conforms to federal regulations.</span>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<p class=MsoNormal> </p>
</div>
<table>
LIST TWO [SHAREPOINT VERBOSITY ABBREVIATED]
<TBODY>
<TR class="ms-alternating ms-itmhover s4-itm-selected" iid="0,15882,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell">
<INPUT class=s4-itm-cbx title="Abstract " value="" type=checkbox _setup="true">
</TD>
<TD class=ms-vb-icon>
<IMG title=Abstract.xml border=0 alt=Abstract.xml src="/_layouts/images/icxddoc.gif">
</TD>
<TD class=ms-vb-title onmouseover=OnChildItem(this) height="100%">
<DIV id=15882 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkFilename" CTXName="ctx0">
<A onfocus=OnLink(this) onmousedown="return VerifyHref(this,event,'1','SharePoint.OpenXMLDocuments.3','1
https://vaww.portal2.va.gov/sites/localresearch/Boston/_layouts/FormServer.aspx?XmlLocation=/sites/localresearch/Boston/ProjectManagement/vhabhsrosed-10-07-2014_03-57_AM/Abstract.xml')" onclick="return DispEx(this,event,'TRUE','FALSE','FALSE','','1','SharePoint.OpenXMLDocuments.3','InfoPath.Document.3','1
https://vaww.portal2.va.gov/sites/localresearch/Boston/_layouts/FormServer.aspx?XmlLocation=/sites/localresearch/Boston/ProjectManagement/vhabhsrosed-10-07-2014_03-57_AM/Abstract.xml','','1','0','0','0x7fffffffffffffff','','')" href="/sites/localresearch/Boston/ProjectManagement/vhabhsrosed-10-07-2014_03-57_AM/Abstract.xml">Abstract</A><IMG class=ms-newgif title=New alt=New src="/_layouts/1033/images/new.gif"></DIV>
<DIV style="LINE-HEIGHT: 22px; MARGIN: 0px; HEIGHT: 22px; TOP: 622px; LEFT: 983px" class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;" shown="false"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"><IMG style="VISIBILITY: hidden" alt="Open Menu" src="/_layouts/images/ecbarw.png" width=7 height=4></A><SPAN> </SPAN></DIV></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb2 ms-vb-lastCell">Yes</TD></TR>
<TR style="DISPLAY: none" class=ms-itmhover iid="0,15883,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="Application to Use Radioactive Material " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb-icon><IMG title="Application to Use Radioactive Material.xml" border=0 alt="Application to Use Radioactive Material.xml" src="/_layouts/images/icxddoc.gif"></TD>
<TD class=ms-vb-title onmouseover=OnChildItem(this) height="100%">
<DIV id=15883 class="ms-vb itx" onmouseover=OnItem(this) EventType="" Perm="0x7fffffffffffffff" Field="LinkFilename" CTXName="ctx0"><A onfocus=OnLink(this) onmousedown="return VerifyHref(this,event,'1','SharePoint.OpenXMLDocuments.3','1
https://vaww.portal2.va.gov/sites/localresearch/Boston/_layouts/FormServer.aspx?XmlLocation=/sites/localresearch/Boston/ProjectManagement/vhabhsrosed-10-07-2014_03-57_AM/Application%20to%20Use%20Radioactive%20Material.xml')" onclick="return DispEx(this,event,'TRUE','FALSE','FALSE','','1','SharePoint.OpenXMLDocuments.3','InfoPath.Document.3','1
https://vaww.portal2.va.gov/sites/localresearch/Boston/_layouts/FormServer.aspx?XmlLocation=/sites/localresearch/Boston/ProjectManagement/vhabhsrosed-10-07-2014_03-57_AM/Application%20to%20Use%20Radioactive%20Material.xml','','1','0','0','0x7fffffffffffffff','','')" href="/sites/localresearch/Boston/ProjectManagement/vhabhsrosed-10-07-2014_03-57_AM/Application to Use Radioactive Material.xml">Application to Use Radioactive Material</A><IMG class=ms-newgif title=New alt=New src="/_layouts/1033/images/new.gif"></DIV>
<DIV class=s4-ctx onmouseover="OnChildItem(this.parentNode); return false;"><SPAN> </SPAN><A onfocus="OnChildItem(this.parentNode.parentNode); return false;" title="Open Menu" onclick="PopMenuFromChevron(event); return false;" href="javascript:;"></A><SPAN> </SPAN></DIV></TD>
<TD class=ms-vb2></TD>
<TD class="ms-vb2 ms-vb-lastCell">Yes</TD></TR>
<TR class="ms-alternating ms-itmhover" iid="0,15884,0" setEdgeBorder="true">
<TD class="ms-vb-itmcbx ms-vb-firstCell"><INPUT class=s4-itm-cbx title="Committee Action Boilerplate " value="" type=checkbox _setup="true"></TD>
<TD class=ms-vb-icon><IMG title="Committee Action Boilerplate.xml" border=0 alt="Committee Action Boilerplate.xml" src="/_layouts/images/icxddoc.gif"></TD>
<