2016-10-07 45 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