I need a function to trigger if the element recordplayerstick
contains either the pinplace
or pinsongplay
class. The code I currently have returns a syntax error. What is the correct way to do this?
if (document.getElementById('recordplayerstick').classList.contains('pinplace pinsongplay')) {
removepin();
}
You are going to have to do two checks if you are going to use classList.
function removepin() {
console.log("yep");
}
var cList = document.getElementById('recordplayerstick').classList;
if (
cList.contains('pinplace') ||
cList.contains('pinsongplay')) {
removepin();
}
<div id="recordplayerstick" class="pinplace pinsongplay"></div>