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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:23:48+00:00 2026-05-18T11:23:48+00:00

I am attempting to hide certain elements using the combination of keyup with contains.

  • 0

I am attempting to hide certain elements using the combination of keyup with contains. What I want to do is hide the span elements that do not equal my input values.

For instance, if I input the value 1 the spans containing the values 2 and 3 are hidden, leaving only the span containing the 1 visible. I would also want it to show all of the spans if I then deleted the 1 value from the input

Here is what I have so far, http://jsfiddle.net/8TXDM/36/

  • 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-18T11:23:49+00:00Added an answer on May 18, 2026 at 11:23 am
    var $spans = $(".mydiv span");
    
    $('.myinput').keyup(function() {
        var val = this.value;
        if (val) {
            $spans.filter(':contains(' + val + ')').show();
            $spans.filter(':not(:contains(' + val + '))').hide();
        } else {
            $spans.show();
        }
    });
    

    Working demo: http://jsfiddle.net/8TXDM/38/

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

Sidebar

Related Questions

Attempting to print out a list of values from 2 different variables that are
I am attempting to hide the document name from the user by using a
I am attempting to hide some rows in an excel sheet using C#. but
I have certain initializing functions that I use to set up audit logging on
I am attempting to hide this checkbox, which is a check all checkbox in
I'm attempting to hide a part of an url from the address, because it's
I'm attempting to completely hide a custom web part I'm writing under specific circumstances.
I am attempting to do something simple (I thought) - securing my application using
Before attempting to resize an image in PHP using libGD, I'd like to check
When attempting to write/read cookies that have brackets in the name, it seems like

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.