2012-02-27 12 views
0

私は2つのJquery関数を共有ポイントページ上で独立して動作させていますが、一緒に作業したいと思います - 両方の 'if'ステートメントをアクション起こる正しいリスト名が見つかっていて、適切な項目がそのリストにある場合は、その行を非表示にします。2つのそれぞれのjquery関数を共有ポイントに結合します

$(".ms-WPHeader").each(function(){ 

var valx = $(this).text(); 

    if(valx=="ListName"){ 
     alert("found"); 
    } 
}); 


$(".ms-vb-title").each(function(){ 

var val = $(this).text(); 

    if(val=="this item"){ 
     $(this).parents('tr:first').hide(); 

    } 
}); 

私はjQueryのに新しい、まだ構造に新しいをした - 私はどこでも検索した - あなたが役立つことを願って?

追加のコードスニペットはWPHeaderとVB-タイトルとの関係を示しています

<td id="MSOZoneCell_WebPartWPQ2" valign="top"> 
<table width="100%" cellspacing="0" cellpadding="0" border="0" toplevel=""> 
<tbody> 
<tr> 
<td> 
<table width="100%" cellspacing="0" cellpadding="0" border="0"> 
<tbody> 
<tr class="ms-WPHeader"> 
<td id="WebPartTitleWPQ2" style="width:100%;" title="ListName"> 
<h3 class="ms-standardheader ms-WPTitle"> 
<a href="/test/Lists/Content%20List/AllItems.aspx" tabindex="0" accesskey="W"> 
<nobr> 
<span>ListName</span> 
<span id="WebPartCaptionWPQ2"></span> 
</nobr> 
</a> 
</h3> 
</td> 
<td valign="middle" style="width:10px;padding-right:2px;"> 
</td> 
</tr> 
</tbody> 
</table> 
</td> 
</tr> 
<tr> 
<td class="" valign="top"> 
<div id="WebPartWPQ2" style="" allowexport="false" allowdelete="false" width="100%" haspers="false" webpartid="9cc3ce88-c0c6-40d4-84a6-0a14d4bfe3ed"> 
<table width="100%" cellspacing="0" cellpadding="0" border="0"> 
<script> 
<tbody> 
<tr> 
<td> 
<iframeid="FilterIframe1" width="0" height="0" filterlink="http://dab:23292/test/Content%20Library/Template%20page.aspx?Filter=1&View=%7b9CC3CE88%2dC0C6%2d40D4%2d84A6%2d0A14D4BFE3ED%7d" title="Hidden frame to filter list" style="display:none" name="FilterIframe1" src="javascript:false;"> 
<table id="{33B3ECBF-66DA-41AD-811D-F3A2D7F644F7}-{9CC3CE88-C0C6-40D4-84A6-0A14D4BFE3ED}" class="ms-listviewtable" width="100%" cellspacing="0" cellpadding="1" border="0" dir="None" o:webquerysourcehref="http://dab:23292/test/_vti_bin/owssvr.dll?CS=65001&XMLDATA=1&RowLimit=0&List={33B3ECBF-66DA-41AD-811D-F3A2D7F644F7}&View={9CC3CE88-C0C6-40D4-84A6-0A14D4BFE3ED}" summary="Content Meta List"> 
<tbody> 
<tr class="ms-viewheadertr" valign="TOP" style="display: none;"> 
<tr class=""> 
<tr class="ms-alternating"> 
<td class="ms-vb2"> 
<td class="ms-vb2"> 
<td class="ms-vb-title" height="100%"> 
<table id="7" class="ms-unselectedtitle" height="100%" cellspacing="0" surl="" uis="512" cid="0x0100363A3EFC8C275E49B25A04F063C9FADB" ctype="Item" ms="0" csrc="" hcd="" couid="" otype="0" icon="icgen_gif||" ext="" type="" perm="0x7fffffffffffffff" dref="test/Lists/Content List" url="/test/Lists/Content%20List/7_.000" ctxname="ctx1" onmouseover="OnItem(this)"> 
<tbody> 
<tr> 
<td class="ms-vb" width="100%"> 
<a target="_self" onclick="GoToLink(this);return false;" href="/test/Lists/Content%20List/DispForm.aspx?ID=7" onfocus="OnLink(this)">this item 
</a> 
</td> 
<td class=""> 
</tr> 
</tbody> 
</table> 
</td> 
+0

いくつかのHTMLマークアップがありますか?どのクラスがどのクラスを制御しているかわからない – Baz1nga

+0

こんにちはBaz1nga - どちらの関数も、

0

このような何か?

$(".ms-vb-title").each(function(){ 
    var val = $(this).text(); 
    if(val === "this item" && $(this).parents("ul").find(".ms-WPHeader").text() === "ListName") { 
     $(this).parents('tr:first').hide(); 
    } 
}); 

の場合:

var found = false; 
$(".ms-WPHeader").each(function(){ 
    if($(this).text() == "ListName") 
     found = true; 
}); 

$(".ms-vb-title").each(function(){ 
    if($(this).text() == "this item" && found == true) 
     $(this).parents('tr:first').hide(); 
}); 
+0

おかげOptimusCrimeを助けることを願って - しかし、何らかの理由でこのdoesntの仕事 - 真が独立して設定されている - ので、所望の – daveybfire

関連する問題