I have this html :
<div id="para0104" class="entry">
<label for="id0104">d</label>
<div>
<label for="input0104100">
<input id="input0104100" type="radio" name="input0104" value="wxcwxc" />
wxcwxc</label>
<label for="input0104100">
<input id="input0104100" type="radio" name="input0104" value="wc" />
wc</label>
<label for="input0104100">
<input id="input0104100" type="radio" name="input0104" value="az" />
az</label></div>
</div>
I am in a loop for each input type radio, so $(this) return to me these inputs.
How can i retrieve the value “d” in <label for="id0104">d</label> ?
When i try $(this).parent().parent(); i retrieve <div>,
and when i try $(this).parent().parent().parent(); i retrieve <div id="para0104" class="entry">
thanks 🙂
You can use jQuery closest and select the label child: