Background Information
I have a table with a bunch of rows of data. Included in each row is a button that should enable the user to delete the current row. I do no know ahead of time how many rows of data I will end up with. Hence the need for a generic button handler... unless there's another better way.
My table looks like this:
<table class="table table-bordered table-hover tcdata">
<tbody>
<tr>
<td colspan="6">
<h3>Time Conditions</h3></td>
</tr>
<tr id="tcrow0">
<td>
<button id="del_tc0" type="button" class="btn btn-warning btn-circle deletename"><i class="fa fa-times"></i></button> TC 1:</td>
<td>
<input class="form-control starttc tcdata" type="input" placeholder="UTC Start Time (format 00:00:00)" name="starttime0" id="starttime0" value="00:00:00">
</td>
<td>
<input class="form-control starttc tcdata" type="input" placeholder="UTC End Time (format 00:00:00)" name="endtime0" id="endtime0" value="00:00:00">
</td>
<td>
<input class="form-control starttc tcdata" type="input" placeholder="Extension" name="extension0" id="endtime0" value="101">
</td>
<td>
<input class="form-control starttc tcdata" type="input" placeholder="Domain" name="domain0" id="endtime0" value="testdomain">
</td>
<td>
<input class="dow" id="hidden_dow0" type="hidden" value="m,t,w,r,f,s,n">
<label class="checkbox-inline"><b>Days of Week:</b></label>
<input class="checkbox-inline tcdata" type="checkbox" id="dow_m0" name="dow_m0">Mon
<input class="checkbox-inline tcdata" type="checkbox" id="dow_t0" name="dow_t0">Tue
<input class="checkbox-inline tcdata" type="checkbox" id="dow_w0" name="dow_w0">Wed
<input class="checkbox-inline tcdata" type="checkbox" id="dow_r0" name="dow_r0">Thu
<input class="checkbox-inline tcdata" type="checkbox" id="dow_f0" name="dow_f0">Fri
<input class="checkbox-inline tcdata" type="checkbox" id="dow_s0" name="dow_s0">Sat
<input class="checkbox-inline tcdata" type="checkbox" id="dow_n0" name="dow_n0">Sun </td>
</tr>
<tr>
<td>
<button id="addtc" type="button" class="btn btn-success btn-circle"><i class="fa fa-plus"></i></button>
</td>
</tr>
<tr id="submitbtnsection">
<td colspan="6" align="center">
<input type="submit" name="submit" id="submit" class="btn btn-primary" value="Save">
<input type="button" name="cancel" id="cancel" class="btn btn-warning submit" value="Cancel">
<input type="button" name="unassign" id="unassign" class="btn btn-warning" value="Unassign">
</td>
</tr>
</tbody>
</table>
I need a way to write a jquery function that will capture anytime a "del_tcX" button is clicked and then delete the table row that has the corresponding X value. (tcrowX)
Any suggestions would be appreciated.