$(function() { $('.pun .post .user').each(function() { $(this).html($(this).html().replace(/<span class="label/g, '<dd><div class="post_field"><span class="label')); }); $('.post_field:contains("Capa de Post:")').each(function() { var cover = $(this).text().split(': ')[1]; $(this).parents('.user').css({ 'background-image': 'url(' + cover + ')' }); $(this).remove(); }); });