0

If I have two click events assigned to an element how do I remove only one of them using jQuary?

https://www.sololearn.com/learning/2808/ With normal Javascript you use removeEventListener("event", function) method, in jQuary however how do I use the off('event') method to remove only one of the two click events.

6th Jul 2021, 3:30 PM
Karak10
Karak10 - avatar
2 ответов
+ 7
use off() or unbind() depending on the jQuery version used: https://api.jquery.com/off/ https://api.jquery.com/unbind/
6th Jul 2021, 3:36 PM
visph
visph - avatar
+ 4
A) Use unbind with a namespace: https://stackoverflow.com/questions/209029/best-way-to-remove-an-event-handler-in-jquery#210345 B) remove all and add the event you still need again
6th Jul 2021, 3:35 PM
Lisa
Lisa - avatar