Delete Row HTML

I have created a Dynamic HTML table where the user can add/delete rows if they want to. There will be 2 rows to complete at one time. I want to delete the row but for my coding I only able to delete the first row, the second row cannot delete. Anyone have idea on how to delete the row?

$(document).ready(function () {
   $('#addrow').click(function () {
   $(document).on('click', '.delete-row', function () {
function addItem() {
    var itemRow =
        '<tr class="item-row">' +
        '<td><a id="delete" href="javascript:;" title="Remove row">Delete</a></td>' +
        '<td><textarea class="form-control" id="desc" rows="1"></textarea></td>' +
        '<td><input class="form-control tx-right" type="text" id="qty" onkeyup="calc()" value="0"></td>' +
        '<td><input class="form-control tx-right" type="text" id="unitprice" value="0"></td>' +
        '<td><input class="form-control tx-right" type="text" id="amount" disabled></td>' +
    '<tr class="item-row">' +
        '<td></td>' +
        '<td colspan="2"></td>' +
        '<td class="tx-right">Tax:</td>' +
            '<td><select class="form-control select2 input-sm" id="ddlTax">' + "<% =sTaxDDL %>" + '</select></td>' +
            '<td><input class="form-control tx-right" type="text" id="amounttax"></td>' 
          <th class="wd-5p">Action</th>
          <th class="wd-25p">Description</th>
          <th class="wd-10p tx-right">Qty</th>
          <th class="wd-10p tx-right">Unit Price</th>
          <th class="wd-15p tx-right">Amount</th>
      <tbody class="items_table">
        <tr class="item-row">
          <td><a id="delete" href="javascript:;" title="Remove row">Delete</a></td>
          <td><textarea class="form-control row-desc" id="desc" rows="1"></textarea></td>
          <td><input class="form-control tx-right row-qty" type="text" id="qty" onkeyup="calc()" value="0"></td>
          <td><input class="form-control tx-right row-unitprice" type="text" id="unitprice" value="0"></td>
          <td><input class="form-control tx-right row-amount" type="text" id="amount" disabled></td>
        <tr class="item-row">
          <td colspan="2"></td>
          <td class="tx-right">Tax:</td>
          <td><input class="form-control tx-right" type="text" id="amounttax"></td>
        <tr id="hiderow">
          <td colspan="5" class="tx-center tx-15"><b><a id="addrow" href="javascript:;" title="Add a row"><i class="fe fe-plus-circle"></i>Add an Item</a></b></td>
<!-- End Row -->

Read more here:

Content Attribution

This content was originally published by qq games at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: