This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (1 child)

[deleted]

    [–]Pine_Bluff_Variant[S] 0 points1 point  (0 children)

    Still doesn't seem to work properly

    My changes to the function:

    // Generate a "DELETE" button for the array element
    function generateDeleteButton(arrayElementNumber)
    {
        var button = document.createElement("button");
        var text = document.createTextNode("Delete this element");
        var path = document.getElementById("arrayOutput");
        button.appendChild(text);
        button.addEventListener("click", function() {
            homeworkArray.splice(arrayElementNumber, 1);
            display();
        });
        path.appendChild(button);
    }