如何实现“观察者”在没有插件的 Jquery 中?
I need a implementation of http://www.prototypejs.org/api/event/observe in Jquery?
With "frequency" too?
I need to a ticket for cakephp.
Thanks,
Celso.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
原型 observe 相当于 jquery bind
因此,prototype: 中的类似内容
与 jquery: 中的类似:
库中的实际实现不同,但这将提供类似的结果。另外,在 jquery 中,您不必在处理程序的末尾附加一个 bind() 函数,因为 jquery 会自动绑定范围。
Prototype observe is equivalent to jquery bind
so something like this in prototype:
would be equivalent to this in jquery:
The actual implementation in the library is different, but this will provide a similar result. Also, in jquery you won't have to attach a bind() function on the end of your handler as jquery binds the scope automatically.
除此之外,
还要看看
哪个将
click
事件绑定到所有当前甚至未来的元素 - 如果您希望多个对象对点击做出反应或动态添加,则特别有用。有关更详细的说明,请参阅 http://api.jquery.com/on/。in addition to
also take a look at
which binds a
click
event to all present and even future elements - especially usefull if you want multiple objects to react on clicks or which are added dynamically. See http://api.jquery.com/on/ for a more detailed explanation.