Try this:
$('#location_chart iframe').contents().find('#chartArea').click(function
(event) {
alert('hello world');
});
On Monday, June 25, 2012 3:28:45 PM UTC-4, novito wrote:
>
> I have tried doing this:
>
> var iframeDoc = $('#location_chart iframe').contents().get(0);
> console.log(iframeDoc);
> $(iframeDoc).bind('click', function(event ){
> alert('hello world');
> });
>
> But it seems is not binding correctly... Would this be a good approach?
>
> On Monday, June 25, 2012 11:56:52 AM UTC-7, novito wrote:
>>
>> I have rendered some charts with the forceIframe attribute set to false,
>> so the chart is rendered as SVG and I can add a listener whenever that SVG
>> is clicked. I do that because with the Iframe there is no way that I can
>> listen for a click on all the chart (not just the elements) container.
>>
>> However, when trying to use this attribute and rendering the charts on
>> IE8, the chart is rendered within an Iframe, and therefore when I do this:
>>
>> google.visualization.events.addListener(chart, 'ready', function() {
>>
>> document.getElementById('location_chart').getElementsByTagName('svg')[0].onclick
>>
>> = function() {
>> drawCenteredChart();
>> };
>> });
>>
>> It breaks, because there is no SVG element. So my question is: What
>> would be a good solution for this? Why is not rendering the SVG?
>>
>> Thanks
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/4UDqXSZ7gmcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.