Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

How can I filter from several params in data-id

$
0
0

I'm trying to make filter from several divs:

<div class="sgmt" data-id="orange, apple">First one</div>  <div class="sgmt" data-id="onion, apple">Second one</div>  <div class="sgmt" data-id="onion, grape">Third one</div><script>  $param="orange";$('.sgmt').filter(function() {   if ($param == '0') {      return '*';  } else {      return $(this).data('view') == $param;  }  }).addClass("sgmt-show");  </script>

But, it's not working with several params inside data-id, what I'm doing wrong?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>