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 8690641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:56:47+00:00 2026-06-12T23:56:47+00:00

I am populating a Twitter bootstrap accordion with data from my Rails app and

  • 0

I am populating a Twitter bootstrap accordion with data from my Rails app and I am looking to be able to filter the data. I have found some nice jQuery plugins but none seem to filter the data. Is this because it is not a simple list? Edit: Not using a list anymore. This is the code I have so far:

<div id="descriptions">

    <% unless @subcategories.nil? %>
    <form class="filterform" action="#">
        <input class="filterinput" type="text">
    </form>

    <div id="list" class="display-subcategory">
        <div class="accordion" id="accordion2">
            <% @subcategories.each do |s| %>
                <% unless s.description == "No description yet"%>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle purple-text" data-toggle="collapse" data-parent="#accordion2" href="#collapse<%=s.name.gsub(/\s+/, "")%>">
                                <h3><%= s.name %> </h3>
                        </a>
                    </div>
                    <div id="collapse<%=s.name.gsub(/\s+/, "")%>" class="accordion-body collapse out">
                        <div class="accordion-inner">
                            <%= s.description.html_safe %>
                        </div>
                    </div>
                </div>
                <% end %>
            <% end %>
        </div>
        </div>
    <% end %>
</div>

And this is the plugin I am using: http://anthonybush.com/projects/jquery_fast_live_filter/

Edit: I am no longer going to use this plugin and I am going to attempt to write my own filter function.

I am trying to filter by the name of the items but I can’t figure this out and would appreciate some assistance. Thanks.

  • 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-06-12T23:56:48+00:00Added an answer on June 12, 2026 at 11:56 pm

    This is the jQuery I used to filter my accordion, I used this jfiddle to help http://jsfiddle.net/U8T8p/10/:

        (function($) {
    
            $('.filterinput').keyup(function() {
                var a = $(this).val();
                if (a.length > 0) {
                    children = ($("#accordion2").children());
    
                    var containing = children.filter(function () {
                        var regex = new RegExp('\\b' + a, 'i');
                        return regex.test($('a', this).text());
                    }).slideDown();
                    children.not(containing).slideUp();
                } else {
                    children.slideDown();
                }
                return false;
            })
    
        }(jQuery));
    

    So this uses a regex to find my accordion headers and hides them if they don’t match the input. Hope this helps someone else anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im populating the data in the combo box using dataset tables...with some table name..now
I am populating the list view with data I am getting from a JSON
I am populating a DataSet with data from an excel sheet. I now need
I have TreeView Populating from Database And I am Trying to detect the user
I'm populating a drop down with JSON data from getJSON. Populating is working fine,
I'm populating data from my database into my JTable. After I add new data
I'm populating a table with values from my database. I have included a delete
I have a page that I have started building with the Twitter Bootstrap css
I have an NSTableView that is populating with my data source. My data model
My goal is populating a section of a tableview by filling data from all

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.