delete element if checkbox checked

delete element if checkbox checked

Im trying to delete an element if the checkbox inside it is checked.

  1. if($j(this).find('input[id^="checkbox"]:checked').length == 1)
  2. {
  3.       var parts = $j('input[id^="checkbox"]:checked').attr('id').split('-');
  4.       $j('input[id^="checkbox"]:checked').each(function(){
  5.             $j('dl#row-'+parts[1]).remove();
  6.        });
  7. });
however it only removes the last element.

Any ideas?