jQuery“eq()”相当于什么?在 Mootools 中?
我是 Mootools 的新手,并且已经使用 jQuery 一段时间了。我想做的是将一些 jQuery 转换为 mootools。
我用 jQuery 编写了以下内容:
var title = $('a:eq(2)').attr('title');
您如何在 mootools 中编写等效内容?
I am new to Mootools and have been using jQuery for a while. What I am trying to do is convert some jQuery into mootools.
I have the following written in jQuery :
var title = $('a:eq(2)').attr('title');
how would you write the equivalent in mootools?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Mootools 文档有答案,使用
:index()
选择器:要检索标题属性,请使用 getProperty:
注意。这适用于 MooTools Core v1.4.1
Mootools docs have the answer, use the
:index()
selector:To retrieve the title attribute use getProperty:
NB. This applies to MooTools Core v1.4.1
您可以使用双美元函数,它返回与您提供的元素类型匹配的元素数组 -
演示 - http://jsfiddle .net/wWbmC/
更多信息
http://mootools.net/blog/2010/ 03/19/更好的使用元素的方法/
http://solutoire.com/2007/09/20/understanding-mootools-selectors-e-and-es/
You could use the double dollar function, which returns an array of elements matching the element type you supply -
Demo - http://jsfiddle.net/wWbmC/
Further Info
http://mootools.net/blog/2010/03/19/a-better-way-to-use-elements/
http://solutoire.com/2007/09/20/understanding-mootools-selectors-e-and-es/