[英]Jquery help inserting HTML
How do I rewrite this insert html Jquery:如何重写此插入 html Jquery:
var element = findLastInput(this).clone();
element.insertAfter(findLastInput(this));
This is the HTML这是 HTML
To insert it after inside the closest div with the class button-row
.使用 class
button-row
在最近的 div 之后插入它。
My HTML:我的 HTML:
<div class="input numeric integer optional">
<label for="company_webserver" class="integer optional"> Webserver</label>
<input type="number" step="1" size="50" name="company[webserver]" id="company_webserver" class="numeric integer optional">
</div>
<div class="button-row" style="font-size: 11px; width: 110px; float: right; margin-top: -10px; margin-right: 16px;">
<button style="font-size: 11px;" type="button" class="add">Add info</button>
<button style="font-size: 11px;" type="button" class="remove">Remove</button>
</div>
The real solution however is jQuery's nextAll method, I assume that you are trying to find the closest '.button-row' after 'this' and are then trying to append 'someHtml':然而,真正的解决方案是 jQuery 的 nextAll 方法,我假设您试图在“this”之后找到最接近的“.button-row”,然后尝试 append 'someHtml':
jQuery(this).nextAll('.button-row:first').append(someHtml);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.