Insert something .after a set of elements if the first in the set has a certain class.
- by Adripants
I would like to add a label AFTER a group of radio inputs IF the first has a certain class
<label>Has the strategy and all of it's relevant background documents been uploaded</label>
<label for="Radio1"><input type="radio" name="uploaded" class="required cat1" id="Radio1">Yes</label>
<label for="Radio2"><input type="radio" name="uploaded" id="Radio2">No</label>
Radio1 has the class, but I'd like to insert a label after the last (in this case Radio2)
I thought I could use this:
$('input[type="radio"].cat1').siblings('input:last').after('<label>Hi!</label>');
But it doesn't work. Can you pick what I am doing wrong?