| 1 |
jQuery(document).ready(function($) { |
| 2 |
// Check/uncheck all checkboxes |
| 3 |
$('#wpbot_checked_all').on('change', function() { |
| 4 |
$('.wpbot_email_checkbox').prop('checked', $(this).prop('checked')); |
| 5 |
}); |
| 6 |
|
| 7 |
// Delete confirmation and form submission |
| 8 |
$('#wpbot_submit_email_form').on('click', function(e) { |
| 9 |
e.preventDefault(); |
| 10 |
|
| 11 |
var checkedLength = $('.wpbot_email_checkbox:checked').length; |
| 12 |
if (checkedLength === 0) { |
| 13 |
alert('Please select at least one record to delete.'); |
| 14 |
return false; |
| 15 |
} |
| 16 |
|
| 17 |
if (confirm('Are you sure you want to delete the selected ' + checkedLength + ' record(s)?')) { |
| 18 |
$('input[name="wpbot_email_subscription_remove"]').val('1'); |
| 19 |
$('#wpcs_form_sessions').submit(); |
| 20 |
} |
| 21 |
}); |
| 22 |
}); |
| 23 |
|