// jQuery 2.2.2 var set = $('<p></p><b></b><i></i>'); set.filter('b').replaceWith('<a></a>'); console.log( set );
I would expect
<b> to be changed to an
<a> element, but that is not the case.
How can one replace an element if not by using
filter creates a new jQuery Object, this creates a problem.
Sadly, this seems the awkward way of doing such a simple thing:
I suggest updating the API with some kind of a way to do such a replace more easily