const $pdfs = $('a[href$=".pdf"]'); $pdfs.on('click', function(event){ //check if checkbox has been checked //if zero checkboxes are checked if ($(':checked').length === 0){ //prevent download of document event.preventDefault(); //alert the user alert('Please check the box to allow PDF downloads.'); } });
Leave a Reply