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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:20:44+00:00 2026-05-27T14:20:44+00:00

I have a jQuery script which allows me to filter list items as I

  • 0

I have a jQuery script which allows me to filter list items as I type into the textbox….however, it only filters the text out side of the the tags…

Could someone please adapt this script so that it filters the values of inputs, specifically buttons?

In the head of my html file:

<script type="text/javascript" src="js/jquery.liveFilter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
   $(ul#filter_me').liveFilter('slide');
});
</script>

Here is the text box:

<input type="text" class="filter" name="liveFilter" />

Here is the list:

<ul id="filter_me">
<li><input type="button" value="John Slater" /></li>
<li><input type="button" value="Matt Bold" /></li>
<li><input type="button" value="Bob Cool" /></li>
</ul>

if i typed… John, i would see the button with john John Slater as the value.

<input type="button" value="John Slater" />

Here is the external JQuery file:

(function (a) {
    a.fn.liveFilter = function (d) {
        var c = a(this);
        var g;
        if (a(this).is("ul")) {
            g = "li"
        } else {
            if (a(this).is("ol")) {
                g = "li"
            } else {
                if (a(this).is("table")) {
                    g = "tbody tr"
                }
            }
        }
        var e;
        var b;
        var f;
        a("input.filter").keyup(function () {
            f = a(this).val();
            e = a(c).find(g + ':not(:Contains("' + f + '"))');
            b = a(c).find(g + ':Contains("' + f + '")');
            if (d == "basic") {
                e.hide();
                b.show()
            } else {
                if (d == "slide") {
                    e.slideUp(500);
                    b.slideDown(500)
                } else {
                    if (d == "fade") {
                        e.fadeOut(400);
                        b.fadeIn(400)
                    }
                }
            }
        });
        jQuery.expr[":"].Contains = function (j, k, h) {
            return jQuery(j).text().toLowerCase().indexOf(h[3].toLowerCase()) >= 0
        }
    }
})(jQuery);

Any help would be greatly appreciated.

Thankyou 🙂

  • 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-27T14:20:45+00:00Added an answer on May 27, 2026 at 2:20 pm

    You have to tweak the :Contains selector. Something like this:

    jQuery.expr[":"].Contains = function (j, k, h) {
    
        // get children that have a "value" attribute
        // (added sort-of handling for <select> elements)
        var m = jQuery(j).children('[value], select > option[value]');
    
        return m.length
    
            // children were found, base the check on the value
            ? m.filter(function() {
                    return this.value &&
                           this.value.toLowerCase().indexOf(h[3].toLowerCase()) >= 0;
                }).length > 0
    
            // otherwise, base on the "innerText"
            : jQuery(j).text().toLowerCase().indexOf(h[3].toLowerCase()) >= 0;
    }
    

    I’ve commented the piece of code for explanations.

    You can test it on this fiddle.


    Note: this is absolutely not optmized and it might not completely work with all types of elements (other than input[button]), but it gives you the idea.

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

Sidebar

Related Questions

I have a jQuery script which returns the current date into a text box.
I have a jQuery script: $.ajax({ url: /scripts/secure/development/ajax.asp, type: POST, dataType: text, data: cmd=addresses,
I have the following jquery function > <script type=text/javascript> > > $(document).ready(function() { >
I have a jquery script which I need to run only once everything else
I have this jquery script which suppose to hide/show div element base on the
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have script which allows the user to choose an image and write something
If I have, <script src=jquery.js ></script> Then any script after this will allows you
I am currently looking for a JavaScript (jQuery) SlideShow Script which allows me to
I am tryng to use this: http://jqueryui.com/demos/dialog/#modal-form I have: <script type=text/javascript> $(document).ready(function() { $(#dialog).dialog();

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.