Accepted answer

the condition you are checking for

if ($('image').attr('href', '')) {

is invalid, as it is preceeded by

chart = new highcharts.chart(options); 

this creates the image again (in the newly created chart's load handler) with the original zoom.png hence the condition is always true, except the very 1st time, when there is no image.

you need to have a different check like a boolean variable out side to this chart which you will check and then flip every time it is clicked



i cheated a bit by adding a class that denoted the zoom to the container node. i'm not sure why it doesn't recognize the update to the href property, but this is one alternative:

Related Query

More Query from same tag