html格式
<div class="input-group-option-container">
<div class="input-group-option">
<div class="col-md-2">
<div class="form-group" id="add_aantal_huidig_div">
<input type="number" class="form-control" id="add_aantal_huidig[]" name="add_aantal_huidig[]" value="">
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="add_min_aantal_1_div">
<input type="number" class="form-control" id="add_min_aantal_1[]" name="add_min_aantal_1">
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="add_min_aantal_2_div">
<input type="number" class="form-control" id="add_min_aantal_2" name="add_min_aantal_2[]" value="">
</div>
</div>
</div>
</div>
javascript
$(function(){
$(document).on('focus', 'div.input-group-option:last-child input', function(){
var sInputGroupHtml = $('div.input-group-option:last-child').html();
var sInputGroupClasses = $('div.input-group-option').attr('class');
$('div.input-group-option').parent().append(`<div class="${sInputGroupClasses}">${sInputGroupHtml}</div>`);
});
});
风格
.input-group-option-container {
display: flex;
flex-direction: column;
}