我在SharePoint網站的工作表中的行,我需要使用CSS(首選)或JavaScript,以便隱藏有兩個主要的TD錶行: -如何隱藏已TD包含某些值
- TD帶有一個名爲Item Number的文本。
- TD帶有標題爲Item number的輸入。
這裏是加價是如何構建的: -
可以在這個人的意見嗎?
我嘗試下面的腳本,但沒有隱藏項目編號或客戶初始,在思路中披露,所有的TR是具有.MS-formtable類表中: -
<script>
$(function() {
$('.ms-formtable tr').each(function() {
var frstVal = $(this).find('td').eq(0).text();
if (frstVal.match(/Item Number|customer Initials/i)) {
$(frstVal).remove()
}
});
});
</script>
這裏是相關的標記: -
<table width="100%" class="ms-formtable" style="margin-top: 8px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="113" class="ms-formlabel" nowrap="true" valign="top">
<h3 class="ms-standardheader">
<nobr>Item Number</nobr>
</h3></td>
<td width="350" class="ms-formbody" valign="top">
<span dir="none"><input title="Item Number" class="ms-long ms-spellcheck-true" id="_x0049_D1_806a702b-1716-47f5-a93c-16067f502daf_$TextField" type="text" maxlength="255" value=""><br></span>
<span class="ms-metadata">Do not customize at the list level</span>
</td></tr>
編輯
現在我想這個腳本: -
<script>
$(function() {
$('.ms-formtable table').each(function() {
$(this).find('tr').each(function() {
$(this).find('td').text() = 'Item Number';
$(this).remove();
}
});
});
</script>
但沒有隱藏項目編號場...
你能發表html嗎? – Jayababu
@Jayababu我提供了相關的標記。謝謝 –