How to check the checkbox value contains string value from input in javascript

I am looking for a solution like that I have a group of check boxes and on top of that there is a textbox and checkbox has to filter as we type on the textbox.

something like shown below :

How to do this in javascript ??

      $("#searchtext").keyup(function () {
        var inputValue = $('#searchtext').val();
        $("input[type='checkbox']").each(function(){
           l
            if ($(this).attr('value').Contains(inputValue)) 
             {
                
             }  
             else
              {
                 this.checkbox.hide();
             }               
        });
       
    });