Question: Im trying to get an element by id from every object with specified class, so i can get value from that but it says: 

> 
> i[i].getElementById is not a function
> 
> 
> 

```
function filterBy()
{
    var a, txtValue;
    var e = document.getElementById("filterBy");
    var strUser = e.options[e.selectedIndex].value;

    ul = document.getElementById("allproducts");
    li = ul.getElementsByClassName('card');

  for (i = 0; i < li.length; i++) 
  {
      a = li[i].getElementById("prodFilter");
    txtValue = a.value;

    if (e.options[e.selectedIndex].value == "all")
    {
        li[i].style.display = "";
    }
    else if (a == strUser) 
    {
      li[i].style.display = "";
    }
    else 
    {
      li[i].style.display = "none";
    }
  }

}

```

How can i get element by id which is inside every element 'li'?

Answer: 
We have `document.getElementById`, but not `element.getElementById`. You can use `querySelector`:

```
li[i].querySelector('#prodFilter');

```

And notice that `id` should be unique in the document, consider replacing with `class`.
I think you are mixing some things up.

```
li = ul.getElementsByClassName('card');

```

The code above would give a HTMLElementCollection, which is pretty much an array of elements.

```
for (i = 0; i < li.length; i++) 
{
      a = li[i].getElementById("prodFilter");
}

```

This would get you a li element, which you then call getElementById() on. However, not all elements have this function. I believe only document has it (<https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById>).

So you can try this instead of using `li[i]`

```
document.getElementById("prodFilter")

```