使用jquery Bind方法,这是我以前从未见过的 [英] Usage of of jquery Bind method that I never seen before

查看:57
本文介绍了使用jquery Bind方法,这是我以前从未见过的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用jQuery,我遇到了一些我无法理解的示例代码。它指的是绑定方法及其使用方式。这是

Trying to get comfortable with jQuery and I have encountered some sample code that I am having trouble understanding. It refers to the bind method and the way they use it. Here it is

$('textControl').bind(($.browser.opera ? 'keypress', 'keydown') + '.autocomplete', function(event) { code...});

我理解选择按键或keydown,但我不明白为什么他们附加.autocomplete在偶数处理程序名称上?

I understand the selection of either keypress or keydown but what I dont understand is why they attach the .autocomplete on the even handler name?

如果有人可以解决一些很好的问题

if anyone can shed some light that would be great

谢谢

推荐答案

这是jQuery的一个功能,名为 Namespaced Evenets ,它通常在插件中使用,因为它允许插件只是简单快捷地操纵它自己的事件。

This is a features of jQuery called Namespaced Evenets which is often used within Plugins as it allows an easy and quick way for a plugin to only manipulate it's own events.

这篇关于使用jquery Bind方法,这是我以前从未见过的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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