【发布时间】:2011-09-26 10:46:49
【问题描述】:
大家好, 请帮我解决这个问题:假设我们从锚点调用相同的 javascript 函数,但参数不同
<a id="edit1" onclick="foo(1)"></a>
<a id="edit2" onclick="foo(2)"></a>
function foo(id)
{
// let's say the code here hide the clicked anchor and show a new anchor with cancel-edit id
}
场景:
- 我点击了第一个锚点 - 第一个锚点被新锚点替换:
- 如何禁用该功能,所以当我点击第二个锚点时它什么也不做。
- 现在假设我点击了 ID 为 cancel-edit 的锚点,它会拉回 ID 为 edit1 的锚点并重新激活 foo 函数,所以当我再次点击第二个锚点时,它将再次执行 foo 函数...
我希望它很清楚:X! 提前致谢。
【问题讨论】:
标签: jquery function bind unbind die