问题:
I have an input type="image"
. 我有一个input type="image"
。 This acts like the cell notes in Microsoft Excel. 这就像Microsoft Excel中的单元格注释一样。 If someone enters a number into the text box that this input-image
is paired with, I setup an event handler for the input-image
. 如果有人在与该input-image
配对的文本框中input-image
,我将为input-image
设置一个事件处理程序。 Then when the user clicks the image
, they get a little popup to add some notes to the data. 然后,当用户单击image
,他们会弹出一个弹出窗口以向数据添加一些注释。
My problem is that when a user enters a zero into the text box, I need to disable the input-image
's event handler. 我的问题是,当用户在文本框中输入零时,我需要禁用input-image
的事件处理程序。 I have tried the following, but to no avail. 我尝试了以下方法,但无济于事。
$('#myimage').click(function { return false; });
解决方案:
参考一: https://stackoom.com/question/sNR/在jQuery中删除事件处理程序的最佳方法参考二: https://oldbug.net/q/sNR/Best-way-to-remove-an-event-handler-in-jQuery
来源:oschina
链接:https://my.oschina.net/u/4428122/blog/4313840