Where I insert some new content (among other things):
var addedaccessories = false;
//open recommended accessories
selectPlan.addEventListener('change', function() {
accessories.classList.add('accessories--open');
instrumentformbtn.classList.add('instrument-form__btn--enabled');
price.innerHTML = `
<div class="priceinfo__top"><span class="price__largetext">Your plan:</span> ${selectPlan.value} per month for 36 months</div>
<div class="priceinfo__btm">First installment of ${selectPlan.value} payable on checkout</div>
`;
price.style.paddingTop = 0;
price.style.paddingBottom = 0;
if (addedaccessories == false) {
accessories.innerHTML += `<div>
<div class="checkbox_container"> <input value="0.27" id="stand" type="checkbox"><label for="stand">Opus LMS02 lightweight folding music stand supplied with carrying bag in black</label>
<legend>£0.27p for 60 months</legend></div>
<br>
<input value="0.99" id="shoulderrest" type="checkbox"><label for="shoulderrest">Kun violin shoulder rest 4/4</label>
<legend>£0.99p for 60 months</legend>
</div>`;
addedaccessories = true;
}
selectplanmessage.style.display = 'none';
});
Where I want to add my event listener. I need to be able to get the value out of the inputs.
accessories.addEventListener('click', function(e) {
if (e.target.tagName == 'LABEL') {
console.log('worked');
}
});