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 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

Related Questions

Using jquery how do I focus the first element (edit field, text area, dropdown
I'm using jquery tabs ( http://docs.jquery.com/UI/API/1.7.2/Tabs ). Jquery version 1.3.2 and Jquery UI version
Using tinyMCE jquery version. I have a content page where there could be many
I am using JQuery 1.3.2 and UI version 1.7, and Drupal 6.15 I would
Using jQuery , how can I dynamically set the size attribute of a select
Using jQuery, how do you bind a click event to a table cell (below,
Using jQuery, how do you check if there is an option selected in a
Using jQuery, what's the best way to find the next form element on the
Using jQuery, is there a way to select all tag that reference a specific
Using jQuery, how do I delete all rows in a table except the first?

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.