Reputation: 1515
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>
Upvotes: 0
Views: 277
Reputation: 312
You can use square brackets and specify attribute and it's value to select an element
document.querySelector('label[for*=option-value-107]')
Upvotes: 1
Reputation: 1123
Yes you can :
document.querySelector('label[for="option-value-107"]');
Upvotes: 4