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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:59:32+00:00 2026-06-15T11:59:32+00:00

I’m having a problem defining a context for the plugin to search. The thing

  • 0

I’m having a problem defining a context for the plugin to search.

The thing is, i have multiple input-texts (the user can add more and more from a button) and i’m doing something like this:

$('.inp_txt').quicksearch('ul.myList li');

For each input-text, i have a list, like a selectbox, the displays the results while typing. The problem is, when the user starts typing on the first input, the plugin displays all of the .myList from all the other inputs. I need it to display only the list from the input-text where the user are.

I think i cannot use diferent classes for each list and call the plugin for each one specifically, because more inputs can be added via JS while navigating.

Is there anyway i can define the context, using $(this) or something else, so the plugin knows its to search only in that specific list?

Thanks!

  • 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-15T11:59:32+00:00Added an answer on June 15, 2026 at 11:59 am

    The problem you’re having is that your syntax applies a single plug-in instance to all items in your selector.

    $('.inp_txt').quicksearch(...) is like calling ('.inp_txt').click(...) – you’re going to get one handler which is used for every element which matches.

    To get around this, you need to do something like:

    $('.inp_txt').each(function (index, value) {
        var $input = $(value);
    
        // Get a reference to the list you want for this input...
        var $quickSearch = $('ul.myList li');
    
        $input.quicksearch($quicksearch);
    });
    

    This code will loop through each of the .inp_txt items and apply a unique handler for each one.

    In your scenario, it sounds like you have only one ul.myList – which may be another reason why you’re always seeing the same list. If that is the case, you might consider something like…

    <div>
      <input type="text" class="inp_txt" />
      <ul class="myList">
       <li>...</li>
      </ul>
    </div>
    

    Then you can adapt the above code to something like:

    $('.inp_txt').each(function (index, value) {
        var $input = $(value);
        var $quickSearch = $input.siblings('ul.myList');
    
        $input.quicksearch($quicksearch);
    });
    

    This way, you’re getting a unique list for each text box. Obviously, I don’t know the rest of your scenario to know whether or not this is something possible in the logic of your app – but perhaps.

    Finally – when you add new controls, you’ll want to adapt the code which is creating them, so that you’re attaching a new handler to them as well. Something like:

    function addInput(/*... params ...*/) {
        /* Do your logic to create the control */
        $newInput.quicksearch($newList);
    }
    

    In the above code, clearly, it is assumed you would create a $newInput element which would be your new <input type="text" /> – and a new list, which you would call $newList.

    I hope this helps – if not, please feel free to post some comments and clarify, and I’ll try to adapt my answer.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I have been unable to fix a problem with Java Unicode and encoding. The
I need to clean up various Word 'smart' characters in user input, including but
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I am currently running into a problem where an element is coming back from

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.