jQuery First Item for Each ID

Cro*_*ell 5 html javascript jquery

I have two seperate lists and each of the list should add class active. Here is my HTML:

<ul id="list1">
    <li class="item">Object 1</li>
    <li class="item">Object 2</li>
    <li class="item">Object 3</li>
</ul>
<ul id="list2">
    <li class="item">Object 1</li>
    <li class="item">Object 2</li>
    <li class="item">Object 3</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

CSS

.active {
  color: red;
}
Run Code Online (Sandbox Code Playgroud)

JavaSript

$(document).ready(function () {
        $("[id^='list'] .item").first().addClass("active");
});
Run Code Online (Sandbox Code Playgroud)

As you can see only the #list1's first item getting the active class. How can i achive give the both list's first item active class.

Here is the fiddle: https://jsfiddle.net/iCromwell/rkvzhebd/1/

Ada*_*zad 2

尝试遍历父级,然后首先定位.item

$(document).ready(function () {
    $("[id^='list']").each(function(){
       $(this).find('.item').first().addClass("active");
    });
});
Run Code Online (Sandbox Code Playgroud)

小提琴