var x = ""; $(".vlastnici").find("td").not(".partnerSJM").parent().each(function(i) { x +='\n'; }); '\n\n\n' + x + '\n'