i have button with class but doesn't have Id, this is Button Tag ,i want to any sound when i click that button so i called it by getElementsByClassName and added this function
var stopMusicExt = document.getElementsByClassName("slide-control-button-next slide-lockable")[0];
stopMusicExt.onclick = function() {
this.pause();
this.currentTime = 0;
}
but every time browser show this error
Uncaught TypeError: Cannot set property 'onclick' of undefined
what can i do to solve this problem.please?