i'm trying to use this simple script to hide some element by ID, i have the id in a variable but it doesn't work.. this is the code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<script>
function filter(id_get) {
  $(".product").each(function(index) {
    var f = this.id;
    if (!f.includes(id_get)) {
      var hash = "#";
      var cmp = hash.concat(f);
      $(cmp).attr("display", "none");
    }
  });
}
</script>
if i do a console.log(cmp) it displays correct product id to remove, but it doesn't hide the div.
i've also tried $(cmp).hide