[Tag replacement] Replacement an element tag with a new one with preserving attributes #js
$('.selector').replaceWith(function() {
var replacement = $('<new-tag>').html($(this).html());
for (var i = 0; i < this.attributes.length; i++) {
replacement.attr(this.attributes[i].name, this.attributes[i].value);
} return replacement;
});