Appending an element to a Html element using Js

Create a HTML page for the append

<div class="order-information">
            
</div>

Script for appending the code

For each object with content need to be filled.

 var obj = response.items;
                        $.each(obj, function(key,value) {
                            var itemLine = 'itemcheck-'+ value.lineId;
                            var itemClass = 'form-control bill-rma-refund-qty rma-request ' + itemLine;
                            tr_str = '<div class="row row-pdt-list">' +
                            '<div class="col-1"><input type="checkbox" id="'+ itemLine +'" name="checkbox" aria-label="SKU" autocomplete="off" class="item-checkbox"></div>' +
                            '<div class="col"><input type="text" id="item" name="sku" class="form-control rma-request" aria-label="SKU" value="'+ value.item +'" autocomplete="off" readonly="true" disabled></div>';
                            tr_str_org = tr_str_org + tr_str;
                        });

$('.order-information').append(tr_str_org);

Thank you.

Leave a comment

Your email address will not be published. Required fields are marked *