Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:50:52+00:00 2026-05-27T19:50:52+00:00

Based on http://tutorialzine.com/2011/06/beautiful-portfolio-html5-jquery/ tutorial I am trying to implement a sort function to my

  • 0

Based on http://tutorialzine.com/2011/06/beautiful-portfolio-html5-jquery/ tutorial I am trying to implement a sort function to my app.

The problem:

I have the items that I will sort later with quicksand jquery plugin in this format:

<ul>
<li class="car">Audi A6</li>
<li class="car">Audi A8</li>
<li class="car">BMW 328Ci</li>
<li class="hobby">Skying</li>
<li class="hobby">Skating</li>
<li class="hobby">Running</li>
<li class="food">Pizza</li>
<li class="food">Salat</li>
<li class="food">Chicken</li>
</ul>

and then I have 3 checkboxes to be used to sort what to show and what to not:

    <ul id="filter_sources">
        <li><input type="checkbox" id="source" value="car" />car</li>
        <li><input type="checkbox" id="source" value="hobby" />hobby</li>
        <li><input type="checkbox" id="source" value="food" />food</li>
    </ul>

What I want to do is that for each checked checkbox run the quicksand plugin and show the checked boxes, so if the car and hobby checkboxes are checked to show car and hobby lists

I am asking this because in the tutorial they do it this way:

$('#filter_sources').live('click',function(e){
        var link = $(this);

        link.addClass('active').siblings().removeClass('active');

        // Using the Quicksand plugin to animate the li items.
        // It uses data('list') defined by our createList function:

        $('#videosList').quicksand(link.data('list').find('li'));
        e.preventDefault();
    });

and I did some attempts to try for each checked input but I didn’t succeed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:50:53+00:00Added an answer on May 27, 2026 at 7:50 pm

    Tested and, demonstrably, working:

    $('input:checkbox').change(
        function(){
            var show = $('input:checkbox:checked').map(function(){
                               return $(this).val();
                       });
            console.log(show);
            $('#list li').each(
                function(){
                    if ($.inArray($(this).attr('class'),show) > -1) {
                        $(this).show();
                    }
                    else {
                        $(this).hide();
                    }
                });
        });
    

    JS Fiddle demo.

    Note that, for the sake of simplicity, and to avoid the not() method, I opted to assign an id to the list containing the elements to be filtered.


    Edited in response to comment from OP:

    [Only] one problem, when you deselect all the checkboxes after selecting any of them all the results vanishes…

    $('input:checkbox').change(
        function(){
            var show = $('input:checkbox:checked').map(function(){
                               return $(this).val();
                       });
            if (show.length > 0){
                $('#list li').each(
                    function(){
                        if ($.inArray($(this).attr('class'),show) > -1) {
                            $(this).show();
                        }
                        else {
                            $(this).hide();
                        }
                    });
            }
            else {
                $('#list li').show();
            }
        });
    

    JS Fiddle demo.
    References:

    • attr().
    • change().
    • :checkbox selector.
    • hide().
    • :input selector.
    • $.inArray().
    • map().
    • show().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Based on http://api.jquery.com/ajaxComplete/ .ajaxComplete( handler(event, XMLHttpRequest, ajaxOptions) ) .ajaxStart( handler(event) ) To my knowledge
I am trying to implement a HTTP based chat here. All the chat messages
Based on http://ie.microsoft.com/testdrive/HTML5/ECMAScript5Array/Default.html , I thought IE9 supports indexOf in array but the following
Am using jquery and tabs based on http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/ <script type=text/javascript> $(function() { $(.tab_content).hide(); //Hide
Based on http://alexreg.wordpress.com/2009/05/03/strongly-typed-csv-reader-in-c/ , I created a DLL which can read different file types.
I'm building an ogre3d tutorial based on this setup http://www.ogre3d.org/wiki/index.php/SettingUpAnApplication#XCode I've followed all steps
I'm going to do a wpf application using MVVM(It based on http://www.codeproject.com/KB/WPF/MVVMQuickTutorial.aspx ). This
Based on http://www.cplusplus.com/reference/stl/vector/vector/ explicit vector ( const Allocator& = Allocator() ); This vector constructor
Based on http://www.mredkj.com/javascript/nfbasic2.html , following code will result in 5.6e+2 . num = 555.55;
Based on http://www.thinkingguy.net/2010/01/localizing-labelfor-in-aspnet-mvc-2.html I'm trying to use reflection to get to a string property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.