How to move html element from one place on page to another using jQuery? For example for Move Sku attribute in Magento 2 from options to product title on checkout.

How to move html element from one place on page to another using jQuery? For example for Move Sku attribute in Magento 2 from options to product title on checkout.

It can be done using this code:

 

var check_prod_list = jQuery('#checkout .amcheckout-step-container .amcheckout-summary-container .items-in-cart .minicart-items-wrapper ol.minicart-items li.product-item');
if (check_prod_list.length > 0){
jQuery.each(check_prod_list, function(ip,vp){
var opti_sku = jQuery(vp).find('div.product-item-details form div.product.options div dl.item-options');
if (opti_sku.length > 0) {
jQuery.each(opti_sku, function(i,v){
dudu = (jQuery(v).find('dt.label').text()) == 'SKU' ? '<b>SKU:</b> ' + jQuery(v).find('dd.values').text() : '' ;
});
}
if (opti_sku.length == 1 && dudu != '' && jQuery(check_prod_list[ip]).find('#duda.product-item-name').length == 0){
jQuery(check_prod_list[ip]).find('div.product-item-details form div.product.options').hide();
jQuery(check_prod_list[ip]).find('div.product-item-details form .product-item-inner .product-item-name-block .product-item-name').after('<span class="product-item-name" id="duda">' + dudu + '</span>');
} else if (opti_sku.length > 1 && dudu != '' && jQuery(check_prod_list[ip]).find('#duda.product-item-name').length == 0) {
jQuery(check_prod_list[ip]).find('div.product-item-details form .product-item-inner .product-item-name-block .product-item-name').after('<span class="product-item-name" id="duda">' + dudu + '</span>');} else {}});}