I've got a problem with jQuery and removing some elements based on their class. See http://jsfiddle.net/JBKp4/1/
When the delete link is clicked in the itemRow the optionRow's and commentRow of that Item should be delete asswell. But I'cant determine the class of the row.
I hope somebody can help me out. Thank you!
your code can be much simpler:
$('body').on('click', '.delete', function() {
var $tr = $(this).closest('tr');
if ($tr.attr('class') == 'itemRow') {
$tr.nextUntil('tr[class=itemRow]').andSelf().remove();
}
else {
$tr.remove();
}
});
see it working here: http://jsfiddle.net/RASG/MeaRQ/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With