I am building a diary to store my running times, dates and distances. I current have this which is a table with 3 columns of data and a button to append the information stored in the data fields to the next row of the table.

```
<!DOCTYPE HTML>

<head>

<title>Running Diary</title>
<link type = "text/css" rel = "stylesheet" href= "running.css"/>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> 
<script src ="running.js"></script>
</head>

<body>

<!-- Title at the top of page !-->
    <h1 id = "title"> Running Diary </h1>
</br>
</br>
</br>
<!-- Table containing text/date fields and the entries for a running diary. !-->
    <table id = "diary">

<!-- Column titles for the running diary !-->
        <thead id = "diaryHeader">
            <th>Date</th>
            <th>Distance Ran (KM)</th>
            <th>Time</th>
            </th>
        </thead>

<!-- The table row that contains the text field and enter button for adding each entry to the diary !-->
        <tbody>
            <tr id = "diaryFields">
                <td> <input type="date" id="dateField"/></td>
                <td> <input type="number" id="distanceField" placeholder="Distance"/> </td>
                <td> <input type="text" id="timeField" placeholder="HH:MM:SS"/> </td>
                <td> <input type="submit" value="Add" id="diarySubmit"/>

            </tr>

</table>

</body>

```

and the JS:

```
$(document).ready(function(){   

//This handles the click function for diarySubmit button
    $("#diarySubmit").on('click', function(){
//Taking values from each textbox
        var distanceRan = $('#distanceField').val(); 
        var timeRan = $('#timeField').val();
        var dateRan = $('#dateField').val();
//creating the new row to be added with a button to clear the entry 
        var new_row =  '<tr><td>'+distanceRan+'</td><td>'+timeRan+'</td><td>'+dateRan+'</td>'+'<td>'+'<button id="clearRow">Clear Entry'+'</button></td></tr>'
        $('#diary').append(new_row);
        });
});

```

How do I make the '#clearRow' button remove the table row that it is nested inside?

I have come up with this piece of code, but it doesn't work properly, any help please?

```
$('#clearRow').on('click', function(e){
   $(this).closest('tr').remove()
});

```