Horje
how can we give the index of an array as an ID to an element Code Example
how can we give the index of an array as an ID to an element
//Here the delete button gets a unique ID everytime, the ID is the array index of the element. 
array.forEach(function (element, index) {
      display =
        display +
        `<tr>
            <th scope="row">${index + 1}</th>
            <td>${element.first}</td>
            <td>${element.second}</td>
            <td>${element.third}</td>
            <td><button type="button" id="${index}" onclick="deleteNode(this.id)" class="btn btn-danger">Delete</button></td>
        </tr>`;
    });




Javascript

Related
veu js vs angular vs react features Code Example veu js vs angular vs react features Code Example
Error: ENOENT: no such file or directory, scandir Code Example Error: ENOENT: no such file or directory, scandir Code Example
how to pass function arguments without invoke the function Code Example how to pass function arguments without invoke the function Code Example
buffer to base 64 online Code Example buffer to base 64 online Code Example
links Code Example links Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7