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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:01:04+00:00 2026-06-06T15:01:04+00:00

I am accessing wikipedia’s api and getting information about a topic via ajax. The

  • 0

I am accessing wikipedia’s api and getting information about a topic via ajax. The api returns an object that I am parsing like this:

wikipage = data.parse.text['*'].children('p:lt(3)');
wikipage.find('sup').remove();

However, because wikipedia uses pretty loose formatting I have found I must grab the first 3 paragraphs that are returned in order to have enough information. At times, wikipedia will return an empty first paragraph, and a populated 2nd and 3rd paragraph. Other times, 1st and 2nd are empty and 3rd is full. And occasionally all 3 are full of text.

What I need to accomplish is to remove any empty paragraph values from the wikipage object and then make wikipage = to the first p value in the object.

I have tried the following:

wikipage.find('p:empty').remove();
return wikipage.get(0);

but that is not working. It is not removing the empty paragraphs.

I’m new to jQuery and am about to pull my hair out, lol! Please 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-06-06T15:01:04+00:00Added an answer on June 6, 2026 at 3:01 pm

    Try:

    wikipage.find("p").each(function () {
        var $this = $(this);
        if ($this.html().trim() == "") {
            $this.remove();
        }
    });
    

    You could also use the selector:

    $("p", wikipage).each(function () {
    
    });
    

    but I’m not sure of the difference in this situation. When chaining, it makes sense to use .find(), but this selection is at the beginning, so I don’t know how different these are. I’m sure it doesn’t matter, just wanted to point it out!

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

Sidebar

Related Questions

While accessing information using Capabilities, i am getting incorrect values. var screenX:Number = Capabilities.screenResolutionX;
When accessing member that doesn't exist, automatically creates the object. $obj = new ClassName();
Occasionally when accessing OpenX 2.8.1 via its XMLRPC api (using the ruby 'openx' gem),
I accessing a web service after i parsing that that code i got AiringTime
When accessing the winapi method CloseHandle() via .net P/Invoke, should the argument be IntPtr
when accessing foo() of base using derived class's object. #include <iostream> class base {
I've been successfully accessing the LinkedIn API through my CodeIngiter application. I moved to
We are having problems accessing information in .net configuration files (such as app.config and
I am accessing the Facebook Graph JS API, in order to display some of
I've succeeded at accessing a Page's insights via: https://graph.facebook.com/ {pageID}/insights I've even managed to

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.