$(document).on('hidden.bs.modal', '.modal', function () {
  $('.panel', this).remove();
});

$(document).on('hidden.bs.modal', '.modal', function () {
  $('.panel', this).remove();
  $('form', this)[0].reset();
});

Reset form on modal close
Reset form on modal close
