$("img.border").removeClass('border').each(function(){ var t=this; $(this).replaceWith('
'); $("mr",this).append(t); )};