Can I unbind a function inside that function?

Can I unbind an event from inside that same function?

I have both keyup and change events tied to a function but I would like to dynamically add and remove the link to keyup.  Can I do that from inside the function?

Thanks.
newbiewebSr. Software EngineerAsked:
Who is Participating?
 
Gurvinder Pal SinghConnect With a Mentor Commented:
why not

$("#elementid").bind("keyup", function(){
  .. //other code

  $("#elementid").unbind("keyup");
});
0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.