Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用原生代码实现JQuery的on事件绑定 #92

Open
mishe opened this issue Jan 28, 2016 · 0 comments
Open

用原生代码实现JQuery的on事件绑定 #92

mishe opened this issue Jan 28, 2016 · 0 comments

Comments

@mishe
Copy link
Owner

mishe commented Jan 28, 2016

用原生代码实现JQuery的on和off事件绑定

默认只支持$(selector)

可以使用的api

事件绑定 $(selector).on(evt,[selector,]fn)

  • $(selector).on(evt,fn) 给当前的元素集合绑定事件
  • $(selector).on(evt,selector,fn) 给当前的元素集合下的selector元素绑定事件

事件解绑 $(selector).off([event][,fn])

  • $(selector).off() 解绑所有事件
  • $(selector).off(event) 解绑所有的event事件*
  • $(selector).off(event,fn) 解绑指定的事件和handle,目前还有bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant