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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:41:03+00:00 2026-06-02T23:41:03+00:00

I have a situation where the server-side is producing resultant HTML of the form:

  • 0

I have a situation where the server-side is producing resultant HTML of the form:

<div id="myDiv">
    <ul>
        <li class="imageElem">
            <img src="..."/>
            <div id="imgInfo">
                <p class="imgDetail">
                    Image Title #1
                </p>
            </div>
        </li>

        <!-- Etc. for many images (1 <li> per <img>) -->

    </ul>
</div>

I am trying to loop through this list and perform on-the-fly DOM manipulation with jQuery. I’m running into three bottlenecks:

  • How to obtain myDiv‘s single <ul> child that has neither an id or class (and to change the server-side code to produce one of these will be a nightmare); and
  • How to obtain each <li>‘s single <img> child; same as above for getting the server to generates id/class attributes; and
  • How to obtain each <li>‘s single <p> child’s text (e.g. “Image Title #1”)

I am trying the following (for each of those three issues respectively) to no avail:

var myDivUL = document.getElementById("myDiv").ul;
for(i = 0; i < myDivUL.length; i++)
{
    var currImageElem = myDivUL[i].img;
    var currPText = myDiv[i].div.p.text;

    // ... rest of function omitted for brevity
}

What am I doing wrong here? What doe I need to change to get the three elements without having access to id/class attributes? Thanks in advance!

  • 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-02T23:41:06+00:00Added an answer on June 2, 2026 at 11:41 pm

    You can get all things like this:

    $("#myDiv").find("ul:not([id],[class])").each(function()
    {
        $(this).find("li").each(function(){
           var IMG = $(this).find("img:not([id],[class])");
           var PText = $(this).find("p.imgDetail").text();
        });
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following Situation, Server A sends some data (HTML form) to server B,
I have a situation. Sharepoint translates server side Linkfields to regular HTML tag during
I have a situation where I want to use several server side controls, which
Here is the situation: I have a Mediawiki installation, and a few additional server-side
I have an HTML string that contains text and images, e.g. <p>...</p> <img src=...
I have a client server situation, where the client sends the data (a movie
I am using SQL Server 2008 and I have a situation where I have
I am using SQL Server 2000, I have a situation where I am copying
I am using both SQL Server 2008 and 2008 R2, I have a situation
Common situation: I have a client on my server who may update some of

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.