JQuery .insertAfter() DOM 元素
我有一个 HTML 表,我想在其中使用 JQuery
表进行操作:
<tr><td>----Parent One
<Table id="ChildID" >----Child One
First TR1<TR>
<TD><div class=ExternalClass00FA6D5A488C4B2582667D6D8DF15F79>Value 1</div></TD>
<TD class="ms-disc-bordered-noleft">Value 2</TD>
<TD class="ms-disc-bordered-noleft">Value 3</TD>
<TD class="ms-disc-bordered-noleft">
<A HREF="/Threaded.aspx?RootFolder=%2fLists&FolderCTID=0x01200">Value 4</A>
</TD></TR>
..........
Second TR2<TR>
<TD><div class=ExternalClass00FA6D5A488C4B2582667D6D8DF15F79>Value 1</div></TD>
<TD class="ms-disc-bordered-noleft">Value 2</TD>
<TD class="ms-disc-bordered-noleft">Value 3</TD>
<TD class="ms-disc-bordered-noleft">
<A HREF="/Threaded.aspx?RootFolder=%2fLists&FolderCTID=0x01200">Value 4</A>
</TD></TR>
........and so on
</TABLE>---Child One
</td></tr></TABLE>---Parent One
我试图选择 href 中最后一个具有字符串“FolderCTID”的“Value 4”,并插入以“ExternalClass”开头的 div 类的 insertBefore“Value 1”。
我想将行中的每个元素 insertBefore 到同一行中的相应元素
我使用以下代码:
$('a[href*="FolderCTID"]').insertBefore($('div[class^="外部类"]'));
但它正在为每一行插入所有元素...我想我应该做一些事情来指定实体并循环**实体的每一端...
请帮助我
I have a HTML Table which in which i want to manipulate using JQuery
Table:
<tr><td>----Parent One
<Table id="ChildID" >----Child One
First TR1<TR>
<TD><div class=ExternalClass00FA6D5A488C4B2582667D6D8DF15F79>Value 1</div></TD>
<TD class="ms-disc-bordered-noleft">Value 2</TD>
<TD class="ms-disc-bordered-noleft">Value 3</TD>
<TD class="ms-disc-bordered-noleft">
<A HREF="/Threaded.aspx?RootFolder=%2fLists&FolderCTID=0x01200">Value 4</A>
</TD></TR>
..........
Second TR2<TR>
<TD><div class=ExternalClass00FA6D5A488C4B2582667D6D8DF15F79>Value 1</div></TD>
<TD class="ms-disc-bordered-noleft">Value 2</TD>
<TD class="ms-disc-bordered-noleft">Value 3</TD>
<TD class="ms-disc-bordered-noleft">
<A HREF="/Threaded.aspx?RootFolder=%2fLists&FolderCTID=0x01200">Value 4</A>
</TD></TR>
........and so on
</TABLE>---Child One
</td></tr></TABLE>---Parent One
i am trying to pick "Value 4" the last having string "FolderCTID" in href and insertBefore "Value 1" with div class that starts with "ExternalClass".
I want to insertBefore the each element in the row to the corresponding element in the same row
I am using following code:
$('a[href*="FolderCTID"]').insertBefore($('div[class^="ExternalClass"]'));
But it is inserting all the elements for every row....i think i should make something to specify the entities and loop around** each end of the entity...
Please help me on this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
那么你可能想要这个,
试试这个,然后让我知道,
then you may want this,
try this , and let me know,
这可能有帮助。
may this help.