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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:37:36+00:00 2026-06-14T18:37:36+00:00

in Raphaeljs, it wrote this line of code:(only relevant part is shown) …… sets.id

  • 0

in Raphaeljs, it wrote this line of code:(only relevant part is shown)

......
    sets.id = index;
    grid.hex[poly].click(
      function(e)
    {   
        var id=this.id
.....

It sets the id of the sets[] properly, but the id of “this” is the id of the path inside of the sets, the one that was clicked. I have to have the id of the sets. How can I accomplish that?

EDIT:
I want “this” to be sets, not the path that was clicked.

  • 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-14T18:37:40+00:00Added an answer on June 14, 2026 at 6:37 pm

    Bind function to sets

    ......
        sets.id = index;
        grid.hex[poly].click($.proxy(function(e){
             var id = this.id;
        }, sets);
    .....
    

    Or if you are not using jQuery.

    //https://gist.github.com/978329
    if(!Function.prototype.bind) {
       Function.prototype.bind = function(to){
            // Make an array of our arguments, starting from second argument
        var partial = Array.prototype.splice.call(arguments, 1),
            // We'll need the original function.
            fn  = this;
        var bound = function (){
            // Join the already applied arguments to the now called ones (after converting to an array again).
            var args = partial.concat(Array.prototype.splice.call(arguments, 0));
            // If not being called as a constructor
            if (!(this instanceof bound)){
                // return the result of the function called bound to target and partially applied.
                return fn.apply(to, args);
            }
            // If being called as a constructor, apply the function bound to self.
            fn.apply(this, args);
        }
        // Attach the prototype of the function to our newly created function.
        bound.prototype = fn.prototype;
        return bound;
    
    }
    
    grid.hex[poly].click(function(e){
             var id = this.id;
        }.bind(sets));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new to javascript and raphaelJS, so sorry for my messy code, but
I am trying to construct a customized map in raphaeljs , in this i
I'm building a running light library on top of raphaeljs. In the code example
I'm creating an SVG path using the Raphael library and the following code: this.resultsBoxLine1
IE appears to be choking on the following line 2207 from the uncompressed raphaeljs
I'm trying to understand the math on this raphael.js demo: http://raphaeljs.com/pie.js Checkout the sector
EDIT 23/11 : Solution founded ... I wrote $_db instead $this->_db in the constructor
Is it real to make line with 1px weight in SVG or raphaeljs? The
I'm using RaphaelJS for SVG graphics and I've a path like this: var path
I want to resize an image in RaphaelJS following this example: ... . You

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.