vendredi 3 octobre 2014

How to add event on dynamically created table element inside iframe


Vote count:

0




I have an HTML code like this



<table id="Table1">
<tbody>
<tr>
<th scope="col">
Srno.
</th>
<th scope="col">
Emp code
</th>
<th scope="col">
Name
</th>
<th scope="col">
Mobile No
</th>
<th scope="col">
Delete
</th>
</tr>
</tbody>
</table>


I have a button and when the button is clicked the the new tr with 4 td added into table, the code become like this.



<table id="Table1">
<tbody>
<tr>
<th scope="col">
Srno.
</th>
<th scope="col">
Emp code
</th>
<th scope="col">
Name
</th>
<th scope="col">
Mobile No
</th>
<th scope="col">
Delete
</th>
</tr>
<tr>
<td>
1
</td>
<td style="display: none;">
198
</td>
<td>
SHR003
</td>
<td>
Saurabh khandelwal
</td>
<td>
9891491920
</td>
<td>
<img class="clsImage" src="../../images/delete1.png" style="cursor: pointer;">
</td>
</tr>
</tbody>
</table>


Now i used delete image to delete current row which is dynamically added in iframe.For same am using that Jquery code :



$("iframe").contents().find('body').on("click", '.clsImage', function (e) {
alert('111');
});


But after click on delete image button the newest added tr inside the iframe is not gives alert.


I am using `Jquery 1.9.1'


Please help me



asked 53 secs ago







How to add event on dynamically created table element inside iframe

Aucun commentaire:

Enregistrer un commentaire