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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:56:37+00:00 2026-06-07T23:56:37+00:00

I have a dropdown list, a textbox and a button. If I types a

  • 0

I have a dropdown list, a textbox and a button. If I types a word in the textbox and click the button then the dropdown list should select the list item according to that word in the textbox.

For example: If I type 23 then the dropdown should lists the item starting 23.

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

    @GG. is a better option using jQuery UI, but here is a very simple working model not using UI: http://jsfiddle.net/flackend/MA95K/2/

    HTML:

    <input type="text">
    <input type="button" value="Button">
    <select>
        <option>20</option>
        <option>21</option>
        <option>22</option>
        <option>23</option>
    </select>​
    

    jQuery:

    $('input[type="button"]').on('mousedown', function() {
    
        var search_str = $('input[type="text"]').val()
    
        $('option[selected="selected"]').removeAttr('selected');
    
        $('option').each(function() {
            if($(this).text() == search_str)
            {
                $(this).attr('selected', 'selected');
                return false;
            }
        });
    });​
    

    Edit

    Here is a new jsfiddle that uses jQuery UI’s autocomplete: http://jsfiddle.net/flackend/rPGUy/1/


    Edit

    $('option[selected="selected"]').removeAttr('selected'); is basically saying, “find all option tags that have an attribute selected with the value selected, if there are any, and remove that attribute.”

    So this, for example:

    <select>
        <option>20</option>
        <option selected="selected">21</option>
        <option>22</option>
        <option>23</option>
    </select>
    

    Would become this:

    <select>
        <option>20</option>
        <option>21</option>
        <option>22</option>
        <option>23</option>
    </select>
    

    So now when we have jQuery select a new option tag it won’t conflict.

    • 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 with a piece of code that is run when
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
I have a dropdown list and a select list. Both contain quite a few
I have a repeater with a literal, a dropdown list, and a button. <asp:Repeater
I have a dropdown list that I'm converting over to a custom modal dialog.
Dropdown In my site I have a set of SELECT dropdowns that are set
I have the following dropdown list box: <select name=DDLConditional1 size=1> <option selected=selected>is equal to</option>
I have a dropdownlist and a textbox with a button on a form. When
I have got a dropdownlist, a submit button and a textbox in my view.
I have update panel that content check box, textbox, 3 DropDownList with CascadingDropDown extender.

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.