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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:01:04+00:00 2026-05-23T08:01:04+00:00

I try to search with an input field a list of items, <ul class=display>

  • 0

I try to search with an input field a list of items,

<ul class="display">
 <li title="Pizza Otto">some divs</li>
 <li title="Pizza Prono">some divs</li>
 <li title="Pizza David">some divs</li>
</ul>

The code below works fine for words in the <li>...</li> I want to put there some divs and to add a title attribute to <li> where to make the search.

$('input[name="q"]').search('.display li', function(on) {
    on.all(function(results) {
        var size = results ? results.size() : 0
        $('#count').text(size + ' results');
});

Any idea for the right selector here: .search('.display li'? Or where I have to make the changes?

Thanks and sorry for my English…

P.S. Is my first question here!

UPDATE: function to test if the val is contained

 function query(selector) {
    if (val = this.val()) {
      return $(selector + ':contains("' + val + '")');;
    } else {
      return false;
    }
  }
  • 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-23T08:01:05+00:00Added an answer on May 23, 2026 at 8:01 am

    I’m not familiar with the search method… but

    var result=$('.display li["title='+$('input[name="q"]').val()+'"]');
    

    would select the li you’re looking for

    I think @robin-pyon was thinking of the :contains() selector, the .contains() method actually searches for a dom element inside of another dom element, if the text you want to search is contained in the LI you can use this to select the ui:

    var result=$('.display li:contains("'+$('input[name="q"]').val()+'")');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a search form on which I have the following INPUT field <input
Cscope has eleven search input fields in interactive mode. But when I try to
When I try to search a string starting with the slash / character in
I have an XML document that I load in and try to search with
Possible Duplicate: Memory overhead of Java HashMap compared to ArrayList I try to search
just to put it out there -I really did search and try to find
I try to get notification when the Search button is clicked in the keyboard
I'm getting a nothing to repeat error when I try to compile this: search
Try as I might I cannot get my head around what the IteratorIterator class
i try to write a query with Casbah and Salat to query a field

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.