const addRowBtn = document.getElementById('add-row');
const receiversTable = document.querySelector('#receivers-table tbody');

addRowBtn.addEventListener('click', () => {
    var row      = receiversTable.insertRow(-1);
    var cell     = row.insertCell(0);
    var cell1    = row.insertCell(1);
    var cell2    = row.insertCell(2);
    cell.innerHTML = '<input type="text" class="form-control" name="email-receiver-name[]" value="">';
    cell1.innerHTML = '<input type="email" class="form-control" name="email-receiver-email[]" value="">';
    cell2.innerHTML = '<button type="button" class="btn btn-danger btn-sm" onclick="deleteRow(this)"><i class="bi bi-trash"></i></button>';
});

function deleteRow(btn) {
    var row = btn.parentNode.parentNode;
    row.parentNode.removeChild(row);
}