$('img[alt]').each(function(){ $(this).replaceWith('<span>' + $(this).attr('alt') + '</span>'); });
$('img[alt]').replaceWith(function(){ return '<span>' + $(this).attr('alt') + '</span>'; });