Unbind click event
See original GitHub issueHi, I have a single page application which contains a plotly chart with click event handler in it. I have another function which removes the chart and plot a new chart after certain events.
Plotly.newPlot(plotSpace, data, layout)
plotSpace.on('plotly_click', click => {
listAllTransactions(town, click.points[0].data.name, click.points[0].x)
})
Each time the plot is replaced with a new one, the event handler from the previous chart is carried over to the new chart, so a click on the new chart will trigger listAllTransactions
twice: first with town
from the first chart and second with town
from the second chart.
How can I remove the event handler from the first chart? I’ve tried removeEventHandler to no avail.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
.unbind() | jQuery API Documentation
A string containing one or more DOM event types, such as "click" or "submit," or custom event names. ... The function that is...
Read more >jQuery unbind() Method - W3Schools
The unbind() method removes event handlers from selected elements. This method can remove all or selected event handlers, or stop specified functions from ......
Read more >Best way to remove an event handler in jQuery?
This can be done by using the unbind function. $('#myimage'). unbind('click'); You can add multiple event handlers to the same object and event...
Read more >How to Remove an Event Handler using jQuery
Select the selector on which the event handler is to be removed. · Use the unbind() method to remove event. · After click...
Read more >Working of jQuery unbind() Function | Examples - eduCBA
The jQuery unbind() function is a built in function in jQuery. The unbind() function remove event handler which was added by using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any other way to remove or rebind existing handlers without calling
newPlot
? This issue was the first hit in a google search. Also this stack overflow question is linking here: http://stackoverflow.com/questions/37372193/unbind-click-events-in-plotlyI don’t see that we document or test this anywhere, but we do support removeListener and removeAllListeners from the npm
events
module: