Saturday, 17 August 2013

Binding a Client Event to a Different Function

Binding a Client Event to a Different Function

When a page is initially loaded I have the following click event setup
(works fine):
$('#thisIsTheElement').click(function() {
firstFunction();
});
At a later point (after something occurs) I want to change this click to
point to a different function called
secondFunction();
what is the most efficient way to do this?
Should I unbind and bind again? Can this be done in one line?

No comments:

Post a Comment