$('.block1 .block2, .block1 .block3, .block1 .block4').each(function() { var data1 = $(this).text(); alert(data1); });