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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:11:28+00:00 2026-05-14T20:11:28+00:00

Here is my code snippt. But the code is breaking after inner for loop.

  • 0

Here is my code snippt. But the code is breaking after inner for loop. But getting no error message.
Any idea?

Thanks.

    var lastnames   = document.getElementsByClassName('box_nachname');
    var firstnames      = document.getElementsByClassName('box_vorname');
    var teilnehmer  = document.getElementsByClassName('select');
    observers = [];

    // iterate over nachname array.
    for (var i = 0; i < lastnames.length; i++) {

        // Create an observer instance.
        observers[i] = new Observer();


        // Subscribe oberser object.
        for(idx in teilnehmer) {
            if(teilnehmer[idx].id.split("_")[0].toLowerCase() !== "zl") {
                var anynum = function(element) {
                                             observers[i].subscribe(element, updateTeilnehmerSelectbox);
                                         }(teilnehmer[idx]);
            }
        }


        //on blur the Observer fire the updated info to all the subscribers.
        var anynumNachname = function(j, element, value, observer) {
                                            cic.addEvent(lastnames[j], 'blur', observer.fire(element, value));
                                            } (i, lastnames[i], lastnames[i].value, observers[i]);
        cic.addEvent(firstnames[i], 'blur', function(element, value, observer) {observer.fire(element, value)}(lastnames[i], lastnames[i].value, observers[i]));

    }
  • 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-14T20:11:29+00:00Added an answer on May 14, 2026 at 8:11 pm

    You’re using the loop variable “i” in the “addEvent” call. That won’t work properly because every one of the event handlers will share the same “i” and so each will only see the last value that “i” was set to.

    cic.addEvent(firstnames[i], 'blur', (function(index) {
      return function(element, value, observer) {
        observer.fire(element, value)}(lastnames[index], lastnames[index].value, observers[index]);
      };
    })(i));
    

    Also, though I’m not sure this is necessary, I’d put the function you’re calling for “anynumNachname” in parenthesis:

    var anynumNachname = (function(j, element, value, observer) {
      cic.addEvent(lastnames[j], 'blur', observer.fire(element, value));
    })(i, lastnames[i], lastnames[i].value, observers[i]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can't name the recursive template outside itself, but you… May 16, 2026 at 5:13 pm
  • Editorial Team
    Editorial Team added an answer That depends entirely on the details of the implementation, and… May 16, 2026 at 5:13 pm
  • Editorial Team
    Editorial Team added an answer (You don't seem to have gotten any answers after a… May 16, 2026 at 5:13 pm

Trending Tags

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

Top Members

Related Questions

Okay. Here's the code. XML Parsing Error: not well-formed <item_to_page_title><![CDATA[Breaking news, real-time scores and
My question is not about a specific code snippet but more general, so please
Here my code snippet: class Request { public: Request(void); ……….. } Request::Request(void) { qDebug()<<Request:
I'm very new to the world of C++ error handling, but I was told
A beginner question here. My goal: to understand the design rationale behind this. When
Can anyone enlighten me as to why the following code won't work in IE7
I have a question about preg_replace() function. I'm using it with 'e' modifier. Here
Here's a newbie question on the WPF TabControl, TabItem and TabPanel. There is a
Problem: Can't get Unicode character to print correctly. Here is my grammar: options {
I upload a file from a Nokia N97 phone to server, everything works fine

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.