$('.news-content img.Caption,.news-content img.caption').each(function(){ var captext = $(this).attr('title'); captext = '<figcaption class="captext">'+captext+'</figcaption>'; $(this).after(captext); })