jquery each() doesn't loop through newly added table rows

html, javascript, jquery

Solution

In `tbody` you cannot append `td` directly wrap them in `tr`.

Live Demo

$("table > tbody").append("<tr><td>5</td></tr>");
$("table tr td").each(function(){
  alert($(this).text());
});

Problem

I have a very simple table ``` <table> <tr><td>1</td></tr> <tr><td>2</td></tr> <tr><td>3</td></tr> </table> ``` when i append another row to the above table with text 5 in td jquery each() doesn't loop through newly added row it returns only predefined elements not the elements dynamically added ``` $("table > tbody").append("<td>5</td>"); $("table tr td").each(function(){ alert($(this).text()); }); ``` Please see JS FIDDLE LINK HERE

Original source