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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:38:11+00:00 2026-05-13T20:38:11+00:00

I need to grab the text value of a child div. <div id=’first’> <div

  • 0

I need to grab the text value of a child div.

<div id='first'>
    <div id='first_child'>A</div>
    <div id='second_child'>B</div>
    <div id='third_child'>C</div>
</div>

I am trying to grab the value B. I am currently trying this but it is not working,

var text_val = $('#first').next('#second_child').val();
  • 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-05-13T20:38:12+00:00Added an answer on May 13, 2026 at 8:38 pm

    You want to use children() and text() instead of val(). Although, since what you are selecting has an id (and ids must be unique), you could also simply select based on the id without involving the container element at all.

    The val() method only works on input elements, textareas, and selects — basically all form elements that contain data. To get the textual contents of a container, you need to use text() (or html(), if you want the mark up as well).

    var text_val = $('#second_child').text(); //preferred
    

    or

    var text_val = $('#first').children('#second_child').text(); // yours, corrected 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to grab data from this text from this page: http://www.chess.com/home/game_archive?sortby=&show=echess&member=deckers1066 I cannot
This is the code to grab tweets, but i need this in PHP, can
I need to grab the value of the radiobutton option selected with jQuery. I
I need to grab the words out of this string and replace with AND
I have captions in WP that I need to grab the text out of.
I'm trying to extract a portion of text from a string. I need to
I'm painfully new to jQuery and I need to grab the value on change
I need to grab the first 4 characters of two input values (if entered),
The img src that I need to grab is: div id=recaptcha_image class=width: 300px; height:
i need grab to internet explorer address bar. how to get address bar url

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.