<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<span>我是个span1</span>
<span>我是个span2</span>
<section>我是个section</section>
<script>
const all = Array.from(document.all);
const res = all.filter(item=>/^[s]/.test(item.localName))
console.log(res);
</script>
</body>
</html>
获取所有s开头的标签
猜你喜欢
转载自blog.csdn.net/qq_33807889/article/details/105231409
今日推荐
周排行