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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:32:00+00:00 2026-05-15T12:32:00+00:00

I am using jquery 1.3 version <div id=’mainPanel’> <div> <h3>Head #1 <a href=#><input type=text

  • 0

I am using jquery 1.3 version

<div id='mainPanel'>
   <div>   
     <h3>Head #1 <a href="#"><input type="text" value="Type 1"/> </a></h3>

     <div>
        <div id="panel_1">
          <div class="items">
             <div><input type='text' value="0"/></div>
             <div><input type='text' value="1"/></div>
             <div><input type='text' value="2"/></div>
             <div><input type='text' value="3"/></div>
        </div> 
      </div>
     </div>

   <div>   
     <h3>Head #2 <a href="#"><input type="text" value="Type 2"/> </a></h3>
     <div>
        <div id="panel_2">
          <div class="items">
             <div><input type='text' value="0"/></div>
             <div><input type='text' value="1"/></div>
             <div><input type='text' value="2"/></div>
             <div><input type='text' value="3"/></div>
        </div> 
      </div>
     </div>

   <div>
</div>

Now , here i want to access the text box values from head div and need a id i.e. panel_1 and panel_2

so to do that i have written down following code

  $("#mainPanel > div > h3").each(function(index) {

        var panelId = $(this).attr('id'); // i.e. panel_1 and all

        // parent > child notation
        var ele = $(this).next('div > div > div > div').each(function(index){ 


           alert($(this).children('input').val());


});

});

Here i am failed to get the result using parent > child notation

HOW CAN I ACCESS H3 > A > INPUT ‘s value 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-05-15T12:32:01+00:00Added an answer on May 15, 2026 at 12:32 pm

    The <h3> elements do not contain any <div> elements at all, so that first selector will mess things up. Really there’s no need for it to be so complicated:

    $('#panel_1 input').each(function() { ...
    

    will get you all the input elements in “panel_1”.

    edit — an alternative, now that I see what you mean by, “I need an id”:

    $('div.mainPanel div.items').each(function() {
      var containerId = $(this).closest('div[id]').attr('id');
      $(this).find('input').each(function() {
        var anInput = $(this);
        // ...
      });
    });
    

    Relying on a rigid container structure seems like a recipe for long-term problems. That’s why “class” and “id” values are so useful – the exact markup structure can change, but flexible code can continue to work.

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

Sidebar

Ask A Question

Stats

  • Questions 465k
  • Answers 465k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the openssl toolkit to inspect certificates: $… May 16, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer You need to add CausesValidation="false" as an attribute to any… May 16, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer HandleErrorAttribute supplies a Model object of type HandleErrorInfo Your Error… May 16, 2026 at 1:17 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.