Javascript 使用jquery选择单个下一个同级

Javascript 使用jquery选择单个下一个同级,javascript,jquery,html,css,html-table,Javascript,Jquery,Html,Css,Html Table,我正在使用jquery Dragable将内容添加到编辑器的td中。每当我这样做时,我都会在TD的父tr旁边添加一个额外的tr(使用insertAfter),在该tr上删除内容。添加的tr中有一个TD,带有文本,这是tr的副本。现在的问题是,每次用户删除内容时,tr都会被添加。当用户尝试替换已经删除的内容时,也会发生这种情况。这会导致增加不必要的tr 我如何确保tr仅添加到已删除td的父tr旁边一次 var objTR = $(TableEditor.sourceTD).parent()

我正在使用jquery Dragable将内容添加到编辑器的td中。每当我这样做时,我都会在TD的父tr旁边添加一个额外的tr(使用
insertAfter
),在该tr上删除内容。添加的tr中有一个TD,带有文本
,这是tr的副本。现在的问题是,每次用户删除内容时,tr都会被添加。当用户尝试替换已经删除的内容时,也会发生这种情况。这会导致增加不必要的tr

我如何确保tr仅添加到已删除td的父tr旁边一次

    var objTR = $(TableEditor.sourceTD).parent(); /*Get the source TD's parent row */
    var clone = $(objTR).clone(); /*Clone the entire Row in the memory and then insert it */
    if (!copyContent) $(clone).find('td').html("Change the content of this column"); /* if copyContent is false then loop through all the TD's and empty the content of the Td */
    $(clone).find('td').remove();
    $(clone).html('<td class="unlocked" replacesource="1" height="200" valign="top">This is a copy of TR </tr>')
    $(clone).insertAfter(objTR); /*insert the new row*/
var objTR=$(TableEditor.sourceTD).parent()/*获取源TD的父行*/
var clone=$(objTR.clone()/*克隆内存中的整行,然后插入它*/
if(!copyContent)$(clone).find('td').html(“更改此列的内容”);/*如果copyContent为false,则循环遍历所有TD并清空TD的内容*/
$(克隆).find('td').remove();
$(clone.html('这是TR'的副本)
$(克隆).insertAfter(objTR)/*插入新行*/
您可以使用该方法


你能给我们提供一些代码或JSFIDLE吗?
$('sometagid').next();