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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:51:58+00:00 2026-06-13T23:51:58+00:00

I’m doing something weird here, pleae assist if you may. I have a webpage

  • 0

I’m doing something weird here, pleae assist if you may.
I have a webpage with a report which looks like this:

</p></li><li>ARTICLE 1 (NAME 1)<br /><p>    
<div class="list">
Nothing found. 
</div>
</p></li><li>ARTICLE 2 (NAME 2)<br /><p>    

<div class="list">
<h4 class="sub-heading">Items:</h4>  
<li class="item">
...
</li>
<li class="item">
...
</li>

</div>

This repeats throughout the page. Article X is always unique, while Name X may be the same near several Articles. The p elements are inserted by me and can be changed (while css cannot). The divs are output of a plugin beyond my reach. The plugin searches some db and returns “nothing found” or lists the found items.
There should be a table on the same page where all the possible Name X are listed and have 0 across each name by default. What I want to achieve is count Name X and increase the counter near the name only if “nothing found” exists in the element following the p with the Article. I.e, in the above example the table should read

 Name 1     1

 Name 2     0

The same Name X may be found later in the page after next ARTICLE X and with or without “nothing found” in the next element. The rule to increase the counter only if “nothing found” exists should apply.
My first idea was to hide all elements and leave only the list of ARTICLE X where “nothing found” exists in the element below. I did that, and then used the following code to count:

  var n = $("li:contains('Name 1')").length;
  $("span").text("There are " + n)

This is wrong on so many levels. First, it reads the source code which still contains all the elements as even they are hidden they still exist. It also obviously replaces text in all span elements which do exist on page (I’ve taken the span from .text description), and I don’t really know how to insert the output given I can’t control page layout.
Any ideas highly appreciated. 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-13T23:51:59+00:00Added an answer on June 13, 2026 at 11:51 pm

    You can get a count by first selecting elements containing NAME 1, and then checking if they have a child element which contains Nothing found, eg.

    $('li:contains("NAME 1")').children('.list:contains("Nothing found")').length;
    

    For creating and injecting elements into the DOM, have a look at the documentation here

    You can also have a look at this fiddle, which is a really basic example of what I think you’re trying to achieve.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have an autohotkey script which looks up a word in a bilingual dictionary
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I have an array which has BIG numbers and small numbers in it. I

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.