jQuery的$ a函数和对象如何? [英] How is jQuery's $ a function and an object?

查看:155
本文介绍了jQuery的$ a函数和对象如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是 {} [object Object] 中的对象。它如何同时执行 $(选择器) $。fn.init

I mean object as in {} [object Object]. How does it do $(selector) and $.fn.init at the same time?

你能给我一个简单的例子吗?

Can you give me a simple example please?

推荐答案

这不是唯一的jQuery,但是javascript的一个方面。所有功能都是对象。例如:

This isn't unique to jQuery, but an aspect of javascript. All functions are objects. E.g.:

var f = function() { alert('yo'); }
f.foo = "bar";

alert(f.foo); // alerts "bar"
f();          // alerts "yo"

这篇关于jQuery的$ a函数和对象如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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