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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:33:52+00:00 2026-06-04T15:33:52+00:00

I’m iterating over a div using : Can I access a hidden parameter in

  • 0

I’m iterating over a div using :

Can I access a hidden parameter in this div within the iteration ?

<DIV>
    <div id="myDiv" <input type="hidden" name="Language" value="English"> />
</DIV>

$('#myDiv div.id').each(function() {
    //access a hidden parameter of the current div 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-04T15:33:53+00:00Added an answer on June 4, 2026 at 3:33 pm

    You can use one of the following methods:

    $('#myDiv div.id').each(
        function(){
            parameter = $(this).attr('data-hidden-parameter');
            /* or:
            parameter = $(this).data('hidden-parameter');
            */
        });
    

    The first parameter = $(this).attr('data-hidden-parameter') requires the following structure:

    <div class="id" data-hidden-parameter="value"><!-- other stuff --></div>
    

    Whereas the latter works with getting/setting with the data() method of jQuery:

    $(selector).data('hidden-parameter','value'); // sets
    $(selector).data('hidden-parameter'); // gets
    

    If you mean retrieving text, or other content/attributes, from a hidden element that’s a child of the div.id element, with mark-up such as:

    <div class="id">
        <input type="hidden" value="somethingOrOther" />
        <span style="display: none;">Some text in a hidden element</span>
    </div>
    

    You could retrieve that value with:

    $('#myDiv div.id').each(
        function(){
            parameter = $(this).find('input:hidden').val();
            /* or:
            parameter = $(this).find('span').text();
        });
    

    Note your jQuery selector implies you’re iterating over a number of elements, based on the class of those elements, while your class-name, id, implies you’re trying, instead, to search based on the id of an element. This might be pseudo-code to demonstrate your approach, but please don’t use a class-name of id. It’s perfectly valid, but it’s terribly confusing. Albeit this is simply my own, personal, objection and response.


    Edited, to supply a more targeted answer, by amending one of the above suggestions with an appropriate selector:

    var parameter = $('#myDiv').find('input:hidden[name="Language"]').val();
    

    References:

    • attr().
    • data().
    • find().
    • :hidden selector.
    • text().
    • val().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.