My html has nest table, when click anywhere inside the table I like to get the top level table(table1)
code: $(document).on('click', function(event) {
var target = event.target;
var test = $(target).closest('table[class=table1]');
but it find nothing. if I change to $(target).closest('table[onclick=myclick]'), it works. Can someone tell me why?
<table class="table1" onclick="myclick">
<table ......>
<table...><tr><td>click happen here</td><tr/>.......