Suppose I have the following HTML.
<div id="bookmarksList">
<label class="container">
<input type="radio" name="bookmark" id="b1"
onclick="onClicked(this);" checked="checked">
<span class="radioTitle">2014</span>
</label>
<label class="container">
<input type="radio" name="bookmark" id="b2"
onclick="onClicked(this);" checked="checked">
<span class="radioTitle">2015</span>
</label> //So on upto 10
</div>
in onClicked() function, I want to change the color of the checked checkbox's label to red.
I want to do this using jQuery's find() method, but it is giving undefined
$("#bookmarksList").find("input[type=radio]").each(() => {
console.log(this.id);
});
OR
$("#bookmarksList").find("label > input[type=radio]").each(() => {
console.log(this.id);
});
How should I do it? Thank you.