why closest select with attribute filter class name no work

why closest select with attribute filter class name no work

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?
  1. <table class="table1" onclick="myclick">
  2. <table ......>
  3. <table...><tr><td>click happen here</td><tr/>.......