[Solved] Difference between cloned object and hardcoded HTML


your 1st method of using clone will be a good one.

And yes you can manipulate the cloned elements before you bind it to dom.

If you want to access any id or class to cloned element before you bind if to anywhere, you can do like

var cloner = $('.first').clone().prop({
    'class': 'changed_first'
});

cloner.find('#id').css('something','css-value');
var data_id = cloner.find('.class').attr('data-bind');

2

solved Difference between cloned object and hardcoded HTML