I have created one div that is not visible, in that div main table is hidden and I'm cloning that table into another div. that div **id** is `main-div`.

I want to delete the newly generated table from that div using its table id any hint? 

```js
var aggTableNum = 0;
$('.addAggregatorCompo').click(function (e) {
  const originTable = document.getElementById('aggregator-table');
   let newTable = originTable.cloneNode(true);
   newTable.id = 'newAggTable' + ++aggTableNum;
   newTable.querySelectorAll('input').forEach((element) => {
    element.value = '';
  });
   $('#main-div').append(newTable);
  //attach();
});

// write delete table using its id
$('.component-base, .generate-div').on(
  'click',
  '.delete-component',
  function (e) {
    console.log(e.delegateTarget.id);
 }
);
```

```css
#aggregator-table {
  display: none;
}
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button style="margin: 1%" class="addAggregatorCompo">Add Table</button>
<table id="aggregator-table" class="component-base">
        <thead>

        <th colspan="6">Aggregator</th>

        <tr>
          <th> Column Name </th>
          <th> Function </th>
          <th> Alias </th>
          <th> Order </th>

        </tr>
        </thead>
        <tbody>
        <tr>

          <td>
            <input>
            </input>
          </td>
          <td><input>
            </input></td>
          <td>
            <input>
            </input>
          </td>
            <td>
              <input>
              </input>
            </td>
        </tr>
        <tr>
          <td>
        <button style="margin: 1%" onclick="addAgg(this,event)">add Properties</button>
        <!-- <button style="margin: 1%">add Properties</button> -->
        </td>
        <td>
          <button class="delete-component" style="margin: 1%">delete </button>
        </td>
      </tr>
      </tbody>
      </table>
      <div class="generate-div" id="main-div"></div>
```

JsFiddle Linke:-> <https://jsfiddle.net/shreekantbatale2/1w08ksfa/2/>