$(() => {
// Add a target="_blank" to the form when PDF or HTML are selected
// Hide the PDF Formatting section if 'pdf' is not the desired format
$('#download_form select#format').on('change', (e) => {
if ($(e.currentTarget).val() === 'pdf' || $(e.currentTarget).val() === 'html') {
$('#download_form').attr('target', '_blank');
} else {
$('#download_form').removeAttr('target');
}
if ($(e.currentTarget).val() === 'pdf') {
$('#pdf-formatting').show();
} else {
$('#pdf-formatting').hide();
}
});
});