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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:48:45+00:00 2026-06-06T14:48:45+00:00

This is my first question, but I’ve already found this site extremely helpful, so

  • 0

This is my first question, but I’ve already found this site extremely helpful, so thanks to all of you.

So this is the problem. I have a bunch of dynamically generated divs with textareas that I’d like to iterate through. This function here works on the static test divs that I put in, but not on the dynamically created ones.

$jQ('#upload_images_button').on('click', function() {
    var caption_list = [];

    $jQ('textarea.upload_image_caption').each(

    function() {
        caption_list.push($jQ(this).val());
        document.write($jQ(this).val());
    });
});

And here’s the html for each of those divs:

<div class="upload_image_temp_wrapper">                                 
    <div class="upload_wrapper">
        <img src="/images/test/test.jpg" />

        <div class="temp_image_hover_menu">
            <input type="checkbox" checked="checked" />
        </div>
    </div>
    <div class="upload_image_caption_wrapper">
        <textarea class="upload_image_caption" type="text" placeholder="Add a description..."></textarea>
    </div>
</div>

EDIT

Goodness, I feel like an idiot.

I looked back at the script that was generating the new divs and saw that I forget to assign the textareas a class…

Anyway, thanks for all the help. Appreciate all the quick answers!

  • 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-06T14:48:46+00:00Added an answer on June 6, 2026 at 2:48 pm

    The code works fine. Your error is somewhere else. Example: http://jsfiddle.net/Buaja/

    HTML

    <button id="upload_images_button">Upload</button>
    <button id="add-div">Add Div</button>
    
    <div class="upload_image_temp_wrapper">                        
        <div class="upload_wrapper">
            <img src="/images/test/test.jpg" />
    
            <div class="temp_image_hover_menu">
                <input type="checkbox" checked="checked" />
            </div>
        </div>
        <div class="upload_image_caption_wrapper">
            <textarea class="upload_image_caption" type="text" placeholder="Add a description..."></textarea>
        </div>
    </div>​
    

    JS

    $jQ('#upload_images_button').on('click',
        function(){
            var caption_list = [];
    
            $jQ('textarea.upload_image_caption').each(
                function(){
                    caption_list.push($jQ(this).val());
                    console.log($jQ(this).val());
                });     
        }
    );
    
    // Add divs dynamically
    $jQ('#add-div').on('click', function() {
       $jQ(document.body).append($jQ($jQ(".upload_image_temp_wrapper")[0]).clone());
    });
    

    Note

    • Don’t use document.write, that will overwrite everything in the document if called after the page is loaded
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I did some searching for an answer to this question...but I
this is my first question.. so, here we go. i have a site, 100%
this is the first question I post in this site, so you have to
this is my first question, but i use this site a lot this last
this is my first question on stack overflow but I have some experience in
This is my first question on this site. I'm new to php but i've
I have looked at this question first: retain value after page refresh . But
This is really a three-part question, but I've answered the first question myself: I'm
I've looked at this question: Select first instance only with XPath? But if I
This may be a very mundane question, but this is the first jQuery plugin

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.