jQuery dynamically created table rows not responding to events
- by mithunmo
I have a table with one row in my HTML file. Now in jQuery I append lot of rows based on the data in the database. But the anchor tag which is created dynamically doesn't respond
to events. How do I make this anchor tag respond to events?
jQuery part
//Appending rows from the Database
$('<tr> <td> </td> <td id="log'+i+'"><a href="viewlog.php" target="_blank">log</a></td></tr> ').appendTo('#container');
Event part in jQuery
Now when I write a line of code like this it does not respond.
$('#container a ').click(function()
{
alert("Coming here ");
});
//HTML
<html>
<table id="container">
<tr>
<td>
Name
</td>
<td>
Link
</td>
</tr>
</table>
</html>