I have added following table dynamically using Javascript:
<table class="ActionMenu">
<tr>
<td>
<p>Ghanshyam</p>
</td>
</tr>
</table>
i want to get alert on Click of this table..
I tried:
$('body').on("click", ".ActionMenu tr", function (e) {
alert("abcd");
});
$('.ActionMenu ').on("click", "tr", function(){
//do something
});
$('.ActionMenu').live('click',function(){});
$('#ActionTab').delegate('.someClass','click',function(){});
but none of the following Method work.. how can i achive my goal? Thanks
.onstatement should work fine. Maybe the problem is elsewhere$('.ActionMenu').live('click',function(){});works: jsfiddle.net/QMNcc. Maybe you could reproduce your bug in a JsFiddlelivemethod just calls theonmethod itself (making it backward compatable). There is no mention of the version of JQuery being used, which could be whyonis not working.