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

The Archive Base Latest Questions

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

I am using the $.find() method in jQuery and i am not able to

  • 0

I am using the $.find() method in jQuery and i am not able to get all the results which match the selector condition.

This is my HTML

<div class="something">
<label> Hello </label>
<div class="selse">
    <label> Hi </label>
    <label class="imp"> This is </label>
    <label class="imp"> Nooo </label>
</div>
<label class="imp"> Sparta </label>
<label class="imp"> Right ? </label>
</div>

<div class="something">
<label> Hell No </label>
<div class="selse">
    <label> Hi </label>
    <label class="imp"> Cant </label>
</div>
<label class="imp"> touch </label>
<label class="imp"> this </label>
 <label class="imp"> MC  </label>
</div>​

So when i do the following JS

$("div.something").each(function(index) {
   alert(index + ': ' + $(this).find("label.imp").html())
    });​

I expected that it’ll give me 2 alerts . One with 0. This is, Nooo, Sparta, Right ? and the other with 1. Cant, touch, this, MC . But i got just 0. This is and 1. Cant .

I tried using arrays in the same function like this

$("div.something").each(function(index) {
    var arr=[]
    arr = $(this).find("label.cidForm").html();
    alert(arr);
    });​

No i get alert boxes with ‘Undefined’ in them. What am i doing wrong in both these cases ? I just want an array with all the values inside label.imp elements.

Here’s a JSFiddle i put up for the same. http://jsfiddle.net/WPeKF/1/

  • 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:07:51+00:00Added an answer on June 13, 2026 at 11:07 pm

    .html() and other getter methods only return the value of the first matched element. With that in mind, i think you can figure out the logic changes that need to be made.

    Fiddle: http://jsfiddle.net/WPeKF/2/

    Code:

    var arr = $("div.something").map(function(){
        return $(this).find("label.imp").map(function(){
            return $(this).html();
        }).get().join("");        
    }).get();
    console.log(arr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jquery ajax($.ajax) method to get a json object from c# webmethod.This
I am using entity framework and I can't find include method like in this
I find myself using this method a ton to perform actions based on a
I am using JQuery .get method to retrieve some content from a webpage (page
I can't get the .delay method working in jQuery: $.delay(3000); // not working $(queue).delay(3000);
I want to download a file using jQuery Ajax web method, but it's not
I am using jquery ajax method to get data from a web method and
I have been using jQuery's find method and it's been very useful. However, I
I am using this method to find and replace a piece of text and
In my program, I'm using Find.Execute to search for all the word forms 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.