Hi every one,
I have a problem with delete rows of table and rows of collection filed.
I wish to delete row not only remove data but also delete the row of table.
So I use: $(this).find('.form-del-field').trigger('click');
instead of $(this).closest('tr').remove(); or $(this).closest('tr').hide();
Down there is my code to delete some rows which are checked checkbox
$('.cf-table-block').ready(function(){
$('.cf-table-block tbody tr').each(function (){
if ($(this).find('.PCVClick input').prop('checked') != true){
$(this).find('.form-del-field').trigger('click');
}
});
});
but It doesn't work.
And I wish to delete collection row (which has a condition ,such as a row with zero data in a field)
My code:
$('.cf-collection-block').ready(function(){
$('.cf-collection-block ul').each(function (){
if ($(this).find('.TypeAmount input').val() == 0){
$(this).find('.cf-collection-delete').trigger('click');
}
});
});
And it doesn't work,too.
I test my code with hide(); and remove(); method and it works good.
Did I miss something? and what is the best way to remove a row of table or collection (with a condition)?
Help please.
Bongkoch,