The following almost works in replace all instances of span[data-type="yesno"]
with lis, but I'd like to also preserve the attributes, classes, etc. Is there a way to carry over the attributes in the same way as the html?
$('span[data-type="yesno"]').replaceWith(function(){
return $("<li>", {html: $(this).html()});
})
$()
. – Sayer