0

How can I delete specific table rows by giving up the row number in an input field?

The table I want to target: Complete code is linked below.

<table id="uitvoertabel" border="1">
    <tr>
        <th></th>
        <th>Voornaam</th>
        <th>Achternaam</th>
        <th>Aantal punten</th>
    </tr>
    <tr>
        <td>1</td>
        <td>John</td>
        <td>Cruijff</td>
        <td>54</td>
    </tr>
    <tr>
        <td>2</td>
        <td>Frans</td>
        <td>Bauer</td>
        <td>47</td>
    </tr>
    <tr>
        <td>3</td>
        <td>Selah</td>
        <td>Sue</td>
        <td>93</td>
    </tr>
</table>

This is the complete code: https://jsfiddle.net/c6oLf8ye/1/

1 Answer 1

1

Pass the row number you want to delete like 0,1,2,3...

document.getElementById("uitvoertabel").deleteRow(0);

updated the same in: https://jsfiddle.net/3v2rdbmt/

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry for the late response. I finally got it with this code. Thank you very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.