I want to target a label which is part of a CMS system. The simplest way would be to use "for"
I can target the input instead and then the sibling, I just thought I would ask if this is possible.
The main reason I want to do this is to remove the ( £5.00)
<input type="radio" autocomplete="off" name="product_option[54]" value="107" id="option-value-107" onchange="doAjaxPrice(108,'#option-54');">
<label for="option-value-107">1kg( £5.00)</label>
CodePudding user response:
Yes you can :
document.querySelector('label[for="option-value-107"]');
CodePudding user response:
You can use square brackets and specify attribute and it's value to select an element
document.querySelector('label[for*=option-value-107]')