jquery中的绑定和解除绑定是什么意思? [英] What does bind and unbind mean in jquery?

查看:26
本文介绍了jquery中的绑定和解除绑定是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jquery 中的 bind 和 unbind 是什么意思?在白痴慢学习者术语中是什么意思?

What does bind and unbind mean in jquery in idiot slow learner terms?

推荐答案

Binding: 将 handler 耦合到 element(s),当 >event 发生在所述元素上.根据您要处理的事件类型,您可以使用不同的函数,例如 click(function) (alt: bind('click', function)focus(function) (alt: bind('focus', function).

Binding: coupling an handler to an element(s), that will run when an event occurs on said element(s). Depending on what kind of event you want to handle you'd use different functions like click(function) (alt: bind('click', function) or focus(function) (alt: bind('focus', function).

解除绑定:将处理程序元素解耦,以便当事件发生时,处理程序函数不会运行时间更长.解除绑定总是一样的;unbind('click', function) 取消绑定某个处理程序,unbind('click') 取消绑定所有点击处理程序,以及 unbind()> 解除绑定所有处理程序.当然,您可以将 click 替换为其他类型的事件.

Unbinding: de-coupling of an handler from an element(s), so that when an event occurs the handler function will no longer run. Unbinding is always the same; unbind('click', function) to unbind a certain handler, unbind('click') to unbind ALL click handlers, and unbind() to unbind ALL handlers. You can substitute click for other types of events of course.

这篇关于jquery中的绑定和解除绑定是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆