如何在JavaScript中以td_检索ID开头的所有td

如何在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_]');