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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:15:26+00:00 2026-06-02T08:15:26+00:00

Html: <div id=a> <span></span> <img /> </div> jQuery: var a = $(#a).children().find(img); its showing

  • 0

Html:

<div id="a">
    <span></span>
    <img />
</div>

jQuery:

var a = $("#a").children().find("img"); 

its showing a.length = 0. Whats the problem here?

  • 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-02T08:15:27+00:00Added an answer on June 2, 2026 at 8:15 am

    Use this:

    $("#a").find("img");
    

    find searches for descendant of the selectors, and <img> isn’t a descendant of any of <div id="a"> direct childrens.

    find docs:

    Description: Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

    Live DEMO

    Note that you can get the same result with more efficient selector:

    $("#a img")...
    

    descendant selector docs:

    Description: Selects all elements that are descendants of a given ancestor.

    Live DEMO

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

Sidebar

Related Questions

here is my html ( all li and span comes dynamically ) <div id=VMScrollBoth1
jQuery: $(.upvote).click(function() { var id = $(this).attr('id'); var changeImage = ($(this).children('img').attr('src') === siteUrl +
Html looks like: <div class=ticker> <div class=news-heading>Latest News:</div> <span class=active_ticker><a href=#> 1] Lorem ipsum
The relevant snippet of HTML: <span class=a> <div class=fieldname>Question 1</div> <input type=text value= name=q1
I have some html snippet <div id=title>This is title<span id=close>X<span><div> The width of this
I have the following html markup: <div class=wrap_select> <span class=select id=selectdateRange>Today, 25 March, Sun</span>
I have this simple html: <div class=wrapper> <span class=higher> [higher] <span class=lower> hello </span>
Suppose I have the following HTML: <div id=test> <span style=display:inline;>foo</span> <span style=display:none;>bar</span> <span style=display:inline;>baz</span>
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
this is my HTML: <?php echo form_open(base_url().'admin'); ?> <div class=row username> <span class=icon></span> <input

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.