I'm trying to get the values out of the input boxes after clicking the Remove button and before removing the row using jQuery. Right now I'm just trying to get the first box, but haven't had any luck with my selection attempts.
Here is the latest attempt at retrieving the input value having an .editing class. By the way, this is not all of the code. The removeIng function is firing like it's supposed to, I'm just not getting back what I need.
$('.remove_ing').click(removeIng);
function removeIng(){ //removes the row
alert($(this).parentsUntil('tr').find('.editing').val());
$(this).parent().parent().remove();
}
Here is the HTML, I have several rows like this (added dynamically)
<tr>
<td><input type='text' name='ingredient' value='' class='editing' /></td>
<td><input type="text" class='editing_amt' name="amount" size="8" value="100"/></td>
<td><select name='meas' class='editing_meas'></select></td>
<td><input type="button" name="remove_ing" class="remove_ing" value="Remove"/></td>
</tr>
Thanks for the help
.parent().parent(), you should probably do something a little more explicit, like closest. That way if you add a wrapper around yourinputlater, you won't break your call.