Skip to content

Instantly share code, notes, and snippets.

@matthewmorrone
Created February 19, 2021 19:34
Show Gist options
  • Save matthewmorrone/318235d3724d1473376cf1adf522441f to your computer and use it in GitHub Desktop.
Save matthewmorrone/318235d3724d1473376cf1adf522441f to your computer and use it in GitHub Desktop.
(function (a) {
a.fn.replaceTag = function (f) {
var g = [], h = this.length;
while (h--) {
var k = document.createElement(f), b = this[h], d = b.attributes;
for (var c = d.length - 1; c >= 0; c--) {
var j = d[c];
k.setAttribute(j.name, j.value)
}
k.innerHTML = b.innerHTML;
a(b).after(k).remove();
g[h - 1] = k
}
return a(g)
}
})(window.jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment