2016-10-07 47 views
1

Mootools是否具有与jQuery的.is()等效的功能?或者,如果不是,Mootools中这个功能的最佳方法是什么?我搜索了一段时间,似乎无法找到正确的解决方案。mootools相当于jQuery的.is()

我试图在Mootools中实现jQuery的例子。

if(a.is(':last-child')){ 
    console.log('this should return true >', a.is(':last-child')); 
} 

任何帮助将是伟大的,谢谢!

回答

1

那么我不知道一个Mootools的等价物,但你大概可以使用nativematches()函数。 Other Link

var bd = document.body; 
console.log(bd.matches('body')) //true 
console.log(bd.matches(':last-child')) //true 
+0

谢谢菲利普,这工作得很好,我需要什么。 – RossCo

+0

随时接受:) – philipp