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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:47:41+00:00 2026-05-29T03:47:41+00:00

I have a text box and a list box, my ultimate aim is to

  • 0

I have a text box and a list box, my ultimate aim is to use the text box to filter the list box. The below code works however the text box is case sensitive and I need the user to be able to input any case and it filters the list box accordingly, at moment.

Example

"MY SITE" = Works
"my site" = Works
"My Site" = Does not work
"mY sITE" = Does not work 

my JQuery code is

var ddlText, ddlValue, ddl, lblMesg;

$(document).ready(function CacheItems() {
    ddlText = new Array(); ddlValue = new Array();
    ddl = document.getElementById("<%=lstSites.ClientID %>");
    for (var i = 0;
    i < ddl.options.length; i++) {
        ddlText[ddlText.length] = ddl.options[i].text;
        ddlValue[ddlValue.length] = ddl.options[i].value;
    }
});
window.onload = CacheItems;
function FilterItems(value) {
    ddl.options.length = 0; for (var i = 0; i < ddlText.length; i++) {
        if (ddlText[i].toLowerCase().indexOf(value) != -1) {
            AddItem(ddlText[i], ddlValue[i]);
        }
        else if (ddlText[i].toUpperCase().indexOf(value) != -1) {
            AddItem(ddlText[i], ddlValue[i]);
        }
    }
} 
function AddItem(text, value) {
    var opt = document.createElement("option");
    opt.text = text;
    opt.value = value;
    ddl.options.add(opt);
}

Thanks in advance for any help

  • 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-29T03:47:41+00:00Added an answer on May 29, 2026 at 3:47 am

    You can extend jQuery with a new expression for this.

    jQuery.extend(
        jQuery.expr[':'], { 
            ContainsInsensitive : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0" 
    });
    

    See contains() and Is there a case insensitive jQuery :contains selector?

    …or simply transform both values to upper/lower case;

    if (ddlText[i].toLowerCase().indexOf(value.toLowerCase()) != -1) {
      AddItem(ddlText[i], ddlValue[i]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a dropdown list and text box. i disabled both controls using code
I have a web page containing a filtering text box and a list box.
So, I have the following design: List box Text box Push button When I
I have a text box in wxpython (see below) that stores the name of
I have placed a list box and a text box with Selected Index Changed
I have two controls: list box text box The list box binds its data
I have text box to enter a phone number. I'm using AJAX MaskedEditExtender and
I have text box in which your adds values in comma separated values. Once
i have form where i have text box value and link (add). when user
I have a text box which accepts time in the format HH:mm and entries

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.