0
我有兩個jQuery的功能,每個獨立工作在sharepoint頁面上 - 但我希望他們一起工作 - 兩個'if'語句必須是合法的,以便採取行動發生例如如果找到正確的列表名稱並且正確的項目在該列表中,那麼隱藏該行。結合兩個每個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>
我們可以選擇一些html標記!不知道什麼控件類在 – Baz1nga 2012-02-27 13:16:39
Hi Baz1nga - 這兩個函數都在
像這樣的事情?
來源
2012-02-27 13:26:43 OptimusCrime
感謝OptimusCrime - 但由於某種原因,這不起作用 - 真正獨立設置 - 所以期望的AND不會發生 – daveybfire 2012-02-27 14:15:22