I am doing the Drum Machine project and I ran into a small issue. When I push a button. The text on the button should change to the instrument and then back to the letter. I am using Jquery and decided to have it so that on a button click the text changes to the button’s id and then “back” to the original text which is the
It works but only one time.
Any ideas?
The audio doesn’t work but I will deal with that later.
$("button").click(function (event) {
$this = $(this);
$kids = $(event.target).children();
$(this).children()[0].play();
$(this).html($this.attr("id"));
setTimeout(function () {
$this.html($kids.attr("id"));
}, 500);
});
Sorry I figured it out. When I try to play the audio clip it messes up something with the function so the function can’t be repeatable.