I don't think that is the appropriate title but I will explain here better. I have an event that is happening on a click that shows a sticky footer on the bottom of the page. There you can see an HTML5 audio player and a close button. When I click the close button, nothing happens. No error in the browser console. Take a look at the code:
$(document).ready(function(e) {
$(".playButton").click(function() {
// Get the value of the button
var val = $(this).val();
// Paste the audio player
$('#audioContainerBottom').html(show_audio_player(val));
$('#navbarBottomFixed').show();
audio_path = 'https://www.website.com/uploads/files/' + val;
audio_core = $('#audio_core').attr('src', audio_path)[0];
audio_core.play();
$(this).hide();
$(".stopButton").show();
});
$(".stopButton").click(function() {
var val = $(this).val();
$('#navbarBottomFixed').hide();
audio_path = 'https://www.website.com/uploads/files/' + val;
audio_core = $('#audio_core').attr('src', audio_path)[0];
audio_core.stop;
$(".stopButton").hide();
$(".playButton").show();
});
$(".closeBottomSidebar").click(function(e) {
$('#navbarBottomFixed').hide();
alert('Closed!');
});
});
function show_audio_player(audio) {
var src = 'https://www.website.com/uploads/files/' + audio;
audio = '<div class="col-md-10 col-xs-10"><audio controls id="audio_core"> ' +
'<source id="audio_source_id" autoplay src="' + src + '" type="audio/mpeg">' +
'Your browser does not support the audio element.' +
'</audio></div>' +
'<div class="col-md-2 col-xs-2">' +
'<button class="btn btn-danger" id="closeBottomSidebar">' +
'<i class="fa fa-remove"></i> Close </button></div>';
return audio;
}
.stopButton {
display: none;
}
#playerContainer {
display: none;
}
#navbarBottomFixed {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<div id="navbarBottomFixed" class="navbar navbar-default navbar-fixed-bottom">
<div class="container" id="audioContainerBottom">
</div>
</div>