Return to course: Designated Employer Representative TrainingCompliance One
<!-- -->
jQuery(document).ready(function($) {
var videoElements = $('video');
var audioElements = $('audio');
var hasMedia = videoElements.length > 0 || audioElements.length > 0;
function enableNextButton() {
$('#mpcs-classroom-next-lesson-link').prop('disabled', false); // Enable the next button
}
if (hasMedia) {
videoElements.on('ended', function() {
enableNextButton();
});
audioElements.on('ended', function() {
enableNextButton();
});
videoElements.on('play', function() {
$('#mpcs-classroom-next-lesson-link').prop('disabled', true); // Disable the next button on play
});
audioElements.on('play', function() {
$('#mpcs-classroom-next-lesson-link').prop('disabled', true); // Disable the next button on play
});
// Initially disable the next button if there is media
$('#mpcs-classroom-next-lesson-link').prop('disabled', true);
} else {
// Enable the next button if there is no media
$('#mpcs-classroom-next-lesson-link').prop('disabled', false);
}
});