YUI.getElementsBy等效于jQuery [英] YUI.getElementsBy equivalent to jQuery

查看:100
本文介绍了YUI.getElementsBy等效于jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在与YUI.getElementsBy等效的JQuery方法/实现?

Is there any JQuery method/implementation that equivalent to YUI.getElementsBy?

YUI.getElementsBy(方法,标签,根目录,应用,o,覆盖)

YUI.getElementsBy ( method , tag , root , apply , o , overrides )

谢谢, 西蒙

推荐答案

该方法的说明如下:

Array getElementsBy ( method , tag , root , apply , o , overrides )

返回一个HTMLElement数组,这些数组通过了由所应用的测试 提供的布尔方法

Returns an array of HTMLElements that pass the test applied by supplied boolean method

您可以使用 filter 方法在jQuery中复制该功能,如果需要返回一个HTMLElement对象数组,您可以使用 get (否则,您将拥有一个jQuery对象) :

You can replicate that functionality in jQuery with the filter method, and if you want to return an array of HTMLElement objects, you can use get (otherwise you will have a jQuery object):

$(selector).filter(method).get();

在jQuery版本中,tagroot参数都将组合到选择器中.

In the jQuery version, both tag and root arguments would be combined into the selector.

这篇关于YUI.getElementsBy等效于jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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