📜  javascript Element.matches() 函数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:38.979000             🧑  作者: Mango

代码示例1
var elem = document.querySelector('#sandwich');
if (elem.matches('.turkey')) {
    console.log('It matches!');
} else {
    console.log('Not a match... =(');
}