if (i>0) if (i<5) { document.write($(this).children()[i].attr('id')); }else if (i<11){ document.write($(this).children()[i].html()); } }