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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:02:10+00:00 2026-06-02T05:02:10+00:00

Goal: Append a DOM element with functionality. (One global listener is not desire here.)

  • 0

Goal:

Append a DOM element with functionality. (One global listener is not desire here.)

Problem:

I don’t know how to reference the new element in this context. The problem area is the .on event listener and the references to $(this) contained inside. Also, the ability for the function get_value() to call itself again from within.

Relevant Code:

var dom_element = (function() {
    // [...]
    var create = function create( data ) {
        // [...]
        return $('<div />', { 'class': 'element', id: data.i_id })
            // [...]
            .on('load', function get_value() {
                // [...]
                $(this).find('.value').text(s_value);
                // [...]
                setTimeout('get_value()', 5000);
            }());
    },
    // [...]
    return {
        create: create
    };
}());
  • 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-02T05:02:13+00:00Added an answer on June 2, 2026 at 5:02 am

    The load event won’t work on a <div> element.

    If you want to perform some action when the content of the div is updated, you should do so in the code that updates the content.

    var dom_element = (function() {
        // [...]
        var create = function create( data ) {
            // [...]
            var div =  $('<div />', { 'class': 'element', id: data.i_id })
                // [...]
            (function get_value(div) {
                // [...]
                $(div).find('.value').text(s_value);
                // [...]
                setTimeout(function() {
                    get_value(div);
                }, 5000);
            })(div);
    
            return div;
        },
        // [...]
        return {
            create: create
        };
    }());
    

    I updated the code to do what I assume you’re looking for.

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

Sidebar

Related Questions

Goal Pass images generated by one process efficiently and at very high speed to
I'm trying to solve problem 50 on Project Euler . Don't give me the
My goal is to append a new set of product records to an existing
Here is my goal: Take Content profile CCK fields field_firstname and field_lastname to automagically
I trying to append where predicates and my goal is to create the same
I want to be able to dynamically append to an element that was dynamically
I have a jQuery wrapped element which I would like to append to a
My goal here is to make a simple server handling TCP message like process
my goal is to select items from a table and append those items into
Goal: Display a custom location list on google maps based on the location of

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.