I want to match text with my dynamic checkbox.Means if i write H in textbox then it will show all checkbox which are having H in it.Here is my code which is working for static code but not working for dynamic Please help me i am new to jquery and java script
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <meta charset="utf-8" />
    <script type="text/javascript">        $(function () {
            $('#chkfilter').on('keyup', function () {
                var query = this.value;
                $('[id^="chk"]').each(function (i, elem) {
                    if (elem.value.indexOf(query) != -1) {
                        $(this).closest('label').show();
                    } else {
                        $(this).closest('label').hide();
                    }
                });
            });
        });</script>
 
<style>
        input
        {
            display: inline;
        }
    </style>
 
<body>
    <form id="form1" runat="server">
    <label>
        <input type="checkbox" name="chk" id="chk1" value="casual">casual</label><br>
    <label>
        <input type="checkbox" name="chk" id="chk2" value="intermediate">intermediate</label><br>
    <label>
        <input type="checkbox" name="chk" id="chk3" value="hunter">hunter</label><br>
    <label>
        <input type="checkbox" name="chk" id="chk4" value="forest">forest</label><br>
    <label>
        <input type="checkbox" name="chk" id="chk5" value="term">extreme</label><br>
    <label>
        <input type="checkbox" name="chk" id="chk6" value="river">river</label><br>
    <label>
        <input type="checkbox" name="chk" id="chk7" value="beach">beach</label><br>
    <br>
    <br>
    <input type="text" id="chkfilter">
Above  are my static coding
But when i convert it to dynamic checkbox will display with it's value but when i try to match it not working
Below are my dynamic coding
 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <meta charset="utf-8" />
    <script type="text/javascript">        $(function () {
            $('#chkfilter').on('keyup', function () {
                var query = this.value;
                $('[id^="list"]').each(function (i, elem) {
                    if (elem.value.indexOf(query) != -1) {
                        $(this).closest('label').show();
                    } else {
                        $(this).closest('label').hide();
                    }
                });
            });
        });
    </script>
 
 <style>
        input
        {
            display: inline;
            color:Black;
        }
</style>
 
 <form id="form1" runat="server">
    <div>
    <label>
        <ul id="list" runat="server" style="list-style-type: none;">
        </ul>
        </label>
        <div id="filters" runat="server">
        </div>
        <input type="text" id="chkfilter">
    </div>
    </form>
 
protected void Page_Load(object sender, EventArgs e)
    {
        fillcolor();
    }
    public void fillcolor()
    {
        string str = string.Empty;
        string str1 = string.Empty;
        string result = string.Empty;
        clsColor objcolor = new clsColor(true);
        clsColorProduct objProduct = new clsColorProduct(true);
        objcolor.getColor();
        for (int i = 0; i < objcolor.ListclsColor.Count; i++)
        {
            str += "<li><div class='filterblock'><input type='checkbox' id=" + objcolor.ListclsColor[i].ColorID + " name='chk' value=" + objcolor.ListclsColor[i].ColorName + " class='category'><div class='font'><div class='Color' style=background-color:" + objcolor.ListclsColor[i].ColorCode + "></div></div><label  class='font' for=" + objcolor.ListclsColor[i].ColorID + ">" + objcolor.ListclsColor[i].ColorName + "</label></div></li>";
            if (objcolor.ListclsColor[i].ColorID != 0)
            {
                str1 += "<td><div class='resultblock' ColorID=" + objcolor.ListclsColor[i].ColorID + " data-tag=" + objcolor.ListclsColor[i].ColorName + "><div class='desc'><div class='desc_text'><div class='main'><div class='sub'><div class='box'>" + objcolor.ListclsColor[i].ColorName + "<span class=''><img height='10px' style='margin-left: 4px;margin: 0px 0px -1px 4px;'/></span></div></div></div></div></div></div></td>";
                objProduct.getColorp();
                for (int j = 0; j < objProduct.ListclsColorProduct.Count; j++)
                {
                    
                    
                }
            }
        }
        list.InnerHtml = str;
        filters.InnerHtml = result;
        // sugg.InnerHtml = str1;
    }
}
Above dynamic code is working for dynamic checkbox it will bring dynamic checkbox and it's value searching is hot happening