Javascript 将某个类的每个div从开始移动到结束';使用jQuery的父对象
由于我们的一个系统开发人员的错误,我们系统中的一些html输出以错误的顺序输出。因此,作为系统的前端开发人员,我的任务是使用javascript实现对html输出的临时修复,直到错误修复可以应用到我们的系统 当前html输出如下所示:Javascript 将某个类的每个div从开始移动到结束';使用jQuery的父对象,javascript,jquery,html,dom,Javascript,Jquery,Html,Dom,由于我们的一个系统开发人员的错误,我们系统中的一些html输出以错误的顺序输出。因此,作为系统的前端开发人员,我的任务是使用javascript实现对html输出的临时修复,直到错误修复可以应用到我们的系统 当前html输出如下所示: <div class="formdetails p_9 "> <div class="help"> <a class="icamsPopup" onclick="popUp(this.getAttribute
<div class="formdetails p_9 ">
<div class="help">
<a class="icamsPopup" onclick="popUp(this.getAttribute('href')); return false;" href="#">?</a>
</div>
<div class="no_mandatory_marker"></div>
<div class="label">
<label for="p_9" id="p_9ErrorMessage">Mobile Phone</label>
</div>
<div class="detail" id="ext-gen16">
<input type="text" class="textfield x-form-text x-form-field" id="p_9" maxlength="20" size="100" name="p_9" style="width: 174px;">
</div>
</div>
非常感谢您的帮助。您可以使用:
jQuery(".formdetails .help").each(function() {
$(this).appendTo($(this).closest('.formdetails'));
});
您可以使用:
jQuery(".formdetails .help").each(function() {
$(this).appendTo($(this).closest('.formdetails'));
});
您可以使用:
jQuery(".formdetails .help").each(function() {
$(this).appendTo($(this).closest('.formdetails'));
});
您可以使用:
jQuery(".formdetails .help").each(function() {
$(this).appendTo($(this).closest('.formdetails'));
});
试一试
演示:试试看
演示:试试看
演示:试试看
演示:您还可以执行以下操作:
jQuery(".formdetails .help").each(function() {
$(this).parent().append($(this));
});
小提琴:你也可以做:
jQuery(".formdetails .help").each(function() {
$(this).parent().append($(this));
});
小提琴:你也可以做:
jQuery(".formdetails .help").each(function() {
$(this).parent().append($(this));
});
小提琴:你也可以做:
jQuery(".formdetails .help").each(function() {
$(this).parent().append($(this));
});
小提琴:非常感谢。我避免使用“最近的”以防它将.help div分配给它的父对象以外的其他对象,但它在这里似乎工作得很好。非常感谢。我避免使用“最近的”以防它将.help div分配给它的父对象以外的其他对象,但它在这里似乎工作得很好。非常感谢。我避免使用“最近的”以防它将.help div分配给它的父对象以外的其他对象,但它在这里似乎工作得很好。非常感谢。我避免使用“最近”以防它将.help div分配给它的父对象以外的其他对象,但它在这里似乎工作得很好。