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

  • Home
  • SEARCH
  • 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 8080235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:21:13+00:00 2026-06-05T16:21:13+00:00

I downloaded and edited a code that from internet, basically what I want to

  • 0

I downloaded and edited a code that from internet, basically what I want to do is to create a list of strings that I’m reading from the database using JSON.
The list is built perfect, now what I want to do is to filter results (text box) using Jquery.
What’s the best way to do that?
Show the full list of results when users type something in a textbox filter those results in the list.

Thanks

$(function ()
{
    $.ajax({
        url: 'api.php', data: "", dataType: 'json',  success: function(rows)
        {
            var list = $("#toggle").append('<ul></ul>').find('ul');
            for (var i in rows)
            {
            var row = rows[i];
                //var id = row[0];
                var Dname = row[4];
                Dname = Dname.toLowerCase();
                list.append("<li>"+Dname+"</li><div>Pulse</div>");
            }
            $('ul li:odd').addClass('zebra_odd');
            $('ul li:even').addClass('zebra_even');
            $("li").click(function(){
                $(this).toggleClass("active");
                $(this).next("div").stop('true','true').slideToggle();
            });
        }
    });
});
  • 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-05T16:21:15+00:00Added an answer on June 5, 2026 at 4:21 pm

    This works quite nicely:

    $('input').keyup(function() {                       // Bind keyup event to textbox
        var textboxVal = $(this).val().toLowerCase();   // Get value of textbox
        $('ul li').each(function() {                    // loop through the list
            var listVal = $(this).text().toLowerCase(); // get value of the <li>
            if(listVal.indexOf(textboxVal) >= 0) {      // search if textboxVal is in listVal
                $(this).show();                         // if true show this <li>
            } else {
                $(this).hide();                         // else hide this <li>
            }
        });
    });
    

    example: http://jsfiddle.net/PWAXt/

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

Sidebar

Related Questions

Maintaining an signed applet that opens connections to the server it was downloaded from.
I'm downloading thumbnail images from youtube JSON web service using SDWebImage, in order to
WHEN I WAS INSTALLING WSGI MODULE FOR APACHE I downloaded the module from http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py27-3.3.so
I downloaded the xVal sample project from Steve Sanderson’s blog , run it, and
I am looking to create a donate and Dowload script that allows you to
I am trying to create an application that has two UITableViews placed side-by-side. The
Problem: I would like to download 100 files in parallel from AWS S3 using
I have a process where a CSV file can be downloaded, edited then uploaded
this is basically what I'm doing. I select a science article from en.wikipedia.org and
I have a working Python 2.6 code using matplotlib, and would like to get

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.