Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is off the top of my head, not tested or optimized. But something like this should work.</p> <pre><code>//Hide divs with tag value function hide_stuff(tag_value) { $(".productContainer") .filter('[attrList*="'+tag_value+'"]') .each(function(i){ $(this).hide() } ); } //Bind events to form $("form[name='attrList'] input[name='FILTER']").live('change', function(evt){ if($(this).is(':checked')){ var tag = $(this).val(); //e.g. 'Andy Thomas' hide_stuff(tag); } }); </code></pre> <p>If you plan on doing even intermediate jQuery work, this page is a MUST READ <a href="http://api.jquery.com/category/selectors/" rel="nofollow">http://api.jquery.com/category/selectors/</a></p> <p>Edit: Here is how you would do a similar thing with $.data instead (which is just a better way of storing data in attributes).</p> <pre><code>//Hide divs with tag value function hide_stuff(tag_value) { $(".productContainer").filter(function() { return $.inArray(tag_value, $(this).data('tags')); //e.g.'Andy Thomas' is 'tags' data } ) .each(function(i){ $(this).hide() } ); } //Bind events to form $("form[name='attrList'] input[name='FILTER']").live('change', function(evt){ if($(this).is(':checked')){ var tag = $(this).val(); //e.g. 'Andy Thomas' hide_stuff(tag); } }); //jQuery 1.4.3+ only - http://api.jquery.com/data/ &lt;div class="productContainer" data-tags="[1+, Andy Thomas]"&gt; &lt;h3&gt;Some Name Here&lt;/h3&gt; &lt;ul&gt; &lt;li&gt;1+&lt;/li&gt; &lt;li&gt;Andy Thomas&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload