Trying to build a filter.
There is an item list with a static item class, and dynamically generated item class.

```
<div class="itemswrap">
 <div class="item dynamic1"></div>
 <div class="item dynamic2"></div>
 <div class="item dynamic3"></div>
 <div class="item dynamic2"></div>
</div>

```

There is also a filter menu in a sidebar with dynamically generated id's

```
<ul class="subnav">
  <li class="lifilter">
    <input type="checkbox" class="filtercheck" id="dynamic1" />
    <label for="dynamic1">whatever label</label>
  </li>
  <li class="lifilter">
    <input type="checkbox" class="filtercheck" id="dynamic2" />
    <label for="dynamic1">whatever label</label>
  </li>
  <li class="lifilter">
    <input type="checkbox" class="filtercheck" id="dynamic3" />
    <label for="dynamic1">whatever label</label>
  </li>
</ul>

```

The idea is to match filter id's with item classes and once a checkbox is checked, only divs with the matching class should be visible.

Here is a js code i came up with

```
$(".lifilter").each(function(){
    var filter1 = $(this).find('.filtercheck').attr('id');
    if ( $(this).find('input.filtercheck').attr('checked') ) 
    {
      $(".itemswrap .item").hide();
      $('.' + filter1).show();
    }
});

```

And nothing happens...