2015-06-23 67 views
1

我想隱藏一個表格行但我的表沒有ID。由於這是SharePoint代碼,我無法在其中添加ID。沒有ID的CSS選擇器

<td width="99%" class="ms-authoringcontrols"> 
      <table width="100%" class="ms-authoringcontrols"> 
      <tbody><tr><td> 
       <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$InputFile" title="Choose a file" class="ms-fileinput ms-fullWidth" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_InputFile" onfocus="ResetSpFormOnSubmitCalled();" onchange="CheckAssetLibMediaExtension()" type="file" size="35"> 
      </td></tr> 
      <tr><td> 
       <span class="ms-error" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_ctl00" style="display: none;"><span role="alert">You must specify a value for the required field.</span></span> 
       <span id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_ctl01" style="display: none;">The file name is invalid or the file is empty. A file name cannot contain any of the following characters: \/: * ? " &lt; &gt; | # { } % ~ &amp;</span> 
      </td></tr> 
      <tr><td> 
       <a id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OpenWithExplorerLink" accesskey="E" onclick="javascript:return !LaunchOpenInExplorer();" href="#">Upload files using Windows Explorer instead</a> 
      </td></tr> 

      <tr><td> 
       <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$OverwriteSingle" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle" type="checkbox" checked="checked"><label for="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle">Overwrite existing files</label> 
      </td></tr> 

      </tbody></table> 
     </td> 

我想隱藏上表中的第4行。輸入contrains ID,但不知它不工作

<tr><td> 
       <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$OverwriteSingle" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle" type="checkbox" checked="checked"><label for="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle">Overwrite existing files</label> 
      </td></tr> 
+0

你忘了我們表明,你說是不是工作的實際代碼。 – BoltClock

+0

雖然我不知道代碼的其餘部分是什麼樣的,但我建議你嘗試一下:'table.ms-authoringcontrols tr:nth-​​child(4){...}' –

+0

@Ofir Baruch:爲什麼jQuery的必要? – BoltClock

回答

0

tr標籤試試這個

.ms-authoringcontrols tr:nth-child(4) { 
     display: none; 
    } 

FIDDLE DEMO

+0

還有其他的表格。這將隱藏所有表格的第4行 –

+0

已更新我的回答 –

0

只使用nth-child(4)選擇。示例如下。

tr:nth-child(4) { 
    display:none; 
} 
-1

如果這行始終是最後一行,您可以選擇隱藏最後一行(檢查代碼段)。

,如果它總是會在第四行,你可以在CSS更改爲:

.ms-authoringcontrols:nth-child(4) { 
    display: none; 
} 

.ms-authoringcontrols:nth-last-child(1) { 
 
    display:none; 
 
}
<td width="99%" class="ms-authoringcontrols"> 
 
      <table width="100%" class="ms-authoringcontrols"> 
 
      <tbody><tr><td> 
 
       <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$InputFile" title="Choose a file" class="ms-fileinput ms-fullWidth" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_InputFile" onfocus="ResetSpFormOnSubmitCalled();" onchange="CheckAssetLibMediaExtension()" type="file" size="35"> 
 
      </td></tr> 
 
      <tr><td> 
 
       <span class="ms-error" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_ctl00" style="display: none;"><span role="alert">You must specify a value for the required field.</span></span> 
 
       <span id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_ctl01" style="display: none;">The file name is invalid or the file is empty. A file name cannot contain any of the following characters: \/: * ? " &lt; &gt; | # { } % ~ &amp;</span> 
 
      </td></tr> 
 
      <tr><td> 
 
       <a id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OpenWithExplorerLink" accesskey="E" onclick="javascript:return !LaunchOpenInExplorer();" href="#">Upload files using Windows Explorer instead</a> 
 
      </td></tr> 
 

 
      <tr><td> 
 
       <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$OverwriteSingle" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle" type="checkbox" checked="checked"><label for="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle">Overwrite existing files</label> 
 
      </td></tr> 
 

 
      </tbody></table> 
 
     </td>

+0

是的,這總是第4行。但它在sharepoint彈出窗口中打開。不知何故上述CSS不起作用。 我只能將代碼添加到調用頁面。 –