Jquery родительские дочерние селекторы - PullRequest
0 голосов
/ 29 ноября 2010

У меня есть HTML-структура ниже, и я пытаюсь выбрать строку, содержащую текст «Связанный элемент списка:».

Мой Jquery ниже: $ ('# WebPartWPQ3> table (eq: 2)> tbody> tr> td> table> tbody> tr: last '). remove ();но не работает ...

 <DIV id="WebPartWPQ3" fixed_bound allowDelete="false" OnlyForMePart="true" HasPers="true" WebPartID="00000000-0000-0000-0000-000000000000" width="100%">
  <TABLE cellSpacing="0" cellPadding="4" width="100%" border="0" fixed_bound xmlns:ddwrt2="urn:frontpage:internal" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">
    <TBODY fixed_bound>
      <TR fixed_bound>
        <TD class="ms-vb" fixed_bound>&nbsp;
        </TD>
      </TR>
    </TBODY>
  </TABLE>
  <TABLE width="100%" border="0" fixed_bound xmlns:ddwrt2="urn:frontpage:internal" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">
    <TBODY fixed_bound>
      <TR fixed_bound>
        <TD fixed_bound>
          <TABLE cellSpacing="0" width="100%" border="0" fixed_bound>
            <TBODY fixed_bound>
              <TR fixed_bound>
                <TD class="ms-formlabel" vAlign="top" noWrap width="25%" fixed_bound>
                  <B fixed_bound>Title:
                  </B>
                </TD>
                <TD class="ms-formbody" vAlign="top" width="75%" fixed_bound>Employee annual leave approval
                  <BR fixed_bound/>
                  <BR fixed_bound/>
                </TD>
              </TR>
              <TR fixed_bound>
                <TD class="ms-formlabel" width="25%" fixed_bound>
                  <B fixed_bound>Approved Carry Forward days
                    <SPAN class="ms-formvalidation" fixed_bound> *
                    </SPAN>:
                  </B>
                </TD>
                <TD class="ms-formbody" width="75%" fixed_bound>
                  <SPAN fixed_bound>
                    <INPUT class="ms-input" id="ctl00_PlaceHolderMain_TaskForm_ff1_1_ctl00_ctl00_TextField" title="Approved Carry Forward days" style="IME-MODE: inactive" size="11" name="ctl00$PlaceHolderMain$TaskForm$ff1_1$ctl00$ctl00$TextField" fixed_bound value=""/>
                    <BR fixed_bound/>
                  </SPAN>
                </TD>
              </TR>
              <TR fixed_bound>
                <TD class="ms-formlabel" width="25%" fixed_bound>
                  <B fixed_bound>Review Comments:
                  </B>
                </TD>
                <TD class="ms-formbody" width="75%" fixed_bound>
                  <SPAN fixed_bound>
                    <TEXTAREA class="ms-long" id="ctl00_PlaceHolderMain_TaskForm_ff2_1_ctl00_ctl00_TextField" title="Review Comments" name="ctl00$PlaceHolderMain$TaskForm$ff2_1$ctl00$ctl00$TextField" rows="5" fixed_bound>
                    </TEXTAREA>
                    <BR fixed_bound/>
                  </SPAN>
                </TD>
              </TR>
              <TR fixed_bound>
                <TD class="ms-formlabel" vAlign="top" noWrap width="25%" fixed_bound>
                  <B fixed_bound>Related list item:
                  </B>
                </TD>
                <TD class="ms-formbody" vAlign="top" width="75%" fixed_bound>
                  <A href="http://orange.extra.net/people/hr/Workflows/Expire%20the%20employee%20year%20in%20a%20year/" fixed_bound>
                  </A>
                </TD>
              </TR>
            </TBODY>
          </TABLE>
        </TD>
      </TR>
    </TBODY>
  </TABLE>
  <TABLE cellSpacing="0" cellPadding="4" width="100%" border="0" fixed_bound xmlns:ddwrt2="urn:frontpage:internal" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">
    <TBODY fixed_bound>
      <TR fixed_bound>
        <TD class="ms-vb" noWrap fixed_bound>
          <INPUT style="DISPLAY: none" onclick="javascript: __doPostBack('ctl00$PlaceHolderMain$TaskForm','__update;__commit;__redirectsource;__redirectToList={};')" type="button" name="btnSave" fixed_bound jQuery1291028280448="3" value="Save Draft"/>
        </TD>
        <TD fixed_bound>
          <INPUT onclick="javascript: __doPostBack('ctl00$PlaceHolderMain$TaskForm','__update;__workflowTaskComplete={0*};__commit;__redirectsource;__redirectToList={};')" type="button" name="btnMarkSubmited" fixed_bound value="Complete Task"/>
        </TD>
        <TD class="ms-vb" noWrap width="99%" fixed_bound>
          <INPUT onclick="javascript: __doPostBack('ctl00$PlaceHolderMain$TaskForm','__cancel;__redirectsource;__redirectToList={};')" type="button" name="btnCancel" fixed_bound value="Cancel"/>
        </TD>
      </TR>
    </TBODY>
  </TABLE>
</DIV>

Ответы [ 3 ]

1 голос
/ 29 ноября 2010

Я предпочитаю указывать идентификатор для tr и удалять tr по id.$('#trid').remove();

1 голос
/ 29 ноября 2010
$('.ms-formlabel').last().children().remove();
0 голосов
/ 30 ноября 2010
$('#WebPartWPQ3').find('Related list item').closest('tr').remove();
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...