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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:57:54+00:00 2026-06-09T08:57:54+00:00

I keep running up against this issue, which reflects my basic lack of understanding.

  • 0

I keep running up against this issue, which reflects my basic lack of understanding.

I want to collect all instances of a class, then be able to have a function which understands which element instance called it.

I created a Fiddle, http://jsfiddle.net/AKa4s/, which doesn’t work, just to try to explain my question.

It’s like this, I collect all the div elements & assign a function to it:
$(“.square”).each(writeColorpanel);

Then in that function I need to call another function. The next function seems to have absolutely no idea who called. I need caller ID (joke).

The problem is that I end up running the same calculations for different divs, and repeating the function so that I can apply css to each of the divs based on the results.

  • 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-09T08:57:56+00:00Added an answer on June 9, 2026 at 8:57 am

    Is it something like this :

    $(function() {
        $(".square").each(function(i,e) {
            writeColorpanel(i,e);
        });
    
        function writeColorpanel (i, elem) {
           color=3;        
           onColorChange(elem, color);
        }
    
        function onColorChange(elem, color) {
           var m = elem.value
           var q = m*color;
           $('#output_'+elem.id).val(q);
        }
    });
    

    FIDDLE

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

Sidebar

Related Questions

I keep running into this issue: class CCreateShortcutTask : public CTask { public: CCreateShortcutTask(
i keep running in this issue where it will jump out of the for
This is a design issue I keep running into, so I thought I would
I am running a linq query against CRM 2011 and I keep getting this
I keep running into this design problem, and I'm not happy with my solution
I keep running into this error MemCacheError (Broken pipe): Broken pipe on my Rails
I keep running in to this awful OAuth Verification Failure, it seems to not
I've been using RhinoMocks lately but I keep running into an issue. If I
I keep running into issues with a .bat script I want to write to
I keep running into all sorts of nuances between the web site project versus

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.