Best way to remove an event handler in jQuery?

前端 未结 20 2373
庸人自扰
庸人自扰 2020-11-21 11:38

I have an input type=\"image\". This acts like the cell notes in Microsoft Excel. If someone enters a number into the text box that this input-image

20条回答
  •  梦如初夏
    2020-11-21 11:50

    This can be done by using the unbind function.

    $('#myimage').unbind('click');
    

    You can add multiple event handlers to the same object and event in jquery. This means adding a new one doesn't replace the old ones.

    There are several strategies for changing event handlers, such as event namespaces. There are some pages about this in the online docs.

    Look at this question (that's how I learned of unbind). There is some useful description of these strategies in the answers.

    How to read bound hover callback functions in jquery

提交回复
热议问题