We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to determine containing element from chart event

Thread ID:





118345 Feb 27,2015 03:38 PM UTC Mar 3,2015 05:06 AM UTC JavaScript 3
Tags: ejChart
Chris John
Asked On February 27, 2015 03:38 PM UTC


When I have multiple charts on a page, I want to use the same Javascript event handlers for each.  I need to be able to get to the containing element of the chart which raised the event. At the moment I'm struggling to work out how to do this from the sender parameter. Is there a way to do this, or any other workarounds you can suggest?






                    // ...            

                     load: 'onload',

                   // ...          





                    // ...            

                     load: 'onload',

                   // ...          



function onload(sender) {

// How to determine which element contains the chart which is the source of the event? 

// var container = $("#container1") or $("#container2"), etc...


Jayavigneshwaran [Syncfusion]
Replied On March 2, 2015 04:49 AM UTC

Hi Chris,

Thanks for using Syncfusion product.

We have analyzed this and replicated the scenario shown, in our sample.

Consider the below example. This page has two div namely container1 and container2 which is used to render chart.

The below screen shot shows this.

To get the id of the div on chart load, the below code snippet is used


function onchartload(sender){                                               // method called on chart load

        alert("on load of the chart in the div: " +this._id);   // to display alert box


We coded to display an alert box which shows the id of the div on chart load. The below screen shot shows this.

We have also attached the sample in the below location for your reference.

Please let us know if you have any concern.



Chris John
Replied On March 2, 2015 09:07 AM UTC

Hi Jayavigneshwaran,

Brilliant - that's exactly what I need.

Many thanks

Jayavigneshwaran [Syncfusion]
Replied On March 3, 2015 05:06 AM UTC

Hi Chris,
Thanks for your update.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon