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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:35:26+00:00 2026-05-29T15:35:26+00:00

Neither this nor that works. Does anyone know what is going on?? Edit: qwerty

  • 0

Neither this nor that works. Does anyone know what is going on??

Edit:
qwerty is simply called as “qwerty();” when in other pieces of code.
It is supposed to be indepedent.

Edit: I realize what is wrong. The problem lies with the i…

function qwerty () {
..... for loop that changes i ......

var that = this;
this.chara[i] = createlabel.....

this.chara[i].addEventListener('click', function(e) {
    var j = e.source.id;
    alert("hello word");
    alert(this.chara[j].width); // I get the error here
});

this.chara[i].addEventListener('doubleclick', function(e) {
    alert("hello word");
    alert(that.chara[i].width); // I get the error here too.
});
}
  • 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-29T15:35:27+00:00Added an answer on May 29, 2026 at 3:35 pm

    Any JS problem relating to this is likely due to the way the function using this is called. Storing a reference to this in your that variable should let you reference it from within your nested functions, exactly the way you are doing it already – assuming that qwerty() is called in a way that sets this to the correct object in the first place. (Personally I like to call such a variable self since it more accurately reflects what the variable is doing.)

    However, in your function you say you get the error on this line:

    that.chara[i].width
    

    Given that you say this.chara[i].addEventListener(...) I’m guessing that the chara[i] variable holds a reference to a DOM element. If that is the case I’m guessing it is an element type that doesn’t have a width property. Try this:

    that.chara[i].style.width
    

    https://developer.mozilla.org/en/CSS/width

    That’s the best I can do for you without more information about what error you’re getting and how the qwerty() function is called…

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

Sidebar

Related Questions

Defined this way, we can do neither ++x++ nor ++x-- . But on the
ok, this code works just fine in Chrome. But, for some reason it does
I read some code recently that does something like this: bob = {'name': 'Bob
I want to let programmers and myself know that a method does not want
I have an object in a page that has neither data nor type so
I'm not too clear about this and neither are the docs. When I'm creating
When I run this code fragment, neither side is taken. if (Boolean.class.isAssignableFrom(boolean.class)) { uLog.error(Boolean
Shouldn't this be a pretty straightforward operation? However, I see there's neither a size()
It opens neither a tab nor a window: the code for a Google Gadget
It's neither 0x nor 0 ; what is it? Is there?

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.