How to "expand" tags?
4 answers
I rather want to completely get rid of the central tag or replace it with some div. The center icon is not wrapped in anything. Any ideas?
Is it nothing wrapped? then, of course, wrap it with something!
var $center = $('center');
var $newReplacement = $("<div></div>");
$center.wrap($newReplacement);
$newReplacement.html($center.html());
As an alternative:
var $center = $("center");
$("<div></div>")
.insertBefore($center)
.html($center.html())
;
$center.remove();
And again, but this time without losing events:
var $contents = $("center > *")
.clone(true) // not sure if this is needed
.appendTo(
$("<div></div>").insertBefore("center")
)
;
$("center").remove();
+5