如何在JavaScript中以td_检索ID开头的所有td [英] How to retrieve all td where the id begin by td_ in javascript

查看:70
本文介绍了如何在JavaScript中以td_检索ID开头的所有td的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要您的帮助:)!

我有一个页面,其中有很多标签,我必须在数组中检索所有以td_开头的id

I have a page where there are a lot of tags and I have to retrieve in an array all id who begin by td_

我不能使用jQuery框架...否则将会更容易...

I can not use the jQuery framework... Else there will be more easy...

你我该怎么办?

推荐答案

您可以使用querySelector:

You can use the querySelector:

elementList = document.querySelectorAll('td[id^=td_]');

这篇关于如何在JavaScript中以td_检索ID开头的所有td的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆