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
Your selectors are a tad off, at first glance, try:
Since this isn’t working: a couple of things have been suggested:
onmight not be working if you’re on an old version$(body).on('click', '.ActionMenu tr', function() { alert('clicked'); });? Replacing.onwith.liveif needed.$(document).ready(function(){/*script goes here...*/});