Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
あなたの助けが必要です :) !
タグがたくさんあるページがあり、td_ で始まるすべての ID を配列で取得する必要があります。
jQueryフレームワークを使用できません...そうでなければ、もっと簡単になります...
どうすればできますか?
デモ
var nodeList = document.querySelectorAll('[id^=td_]'); // or if only TDs are tergated use: 'td[id^=td_]' instead {thx Derek} var arr = []; // Will hold the array of Node's for (var i = 0, ll = nodeList.length; i < ll; arr.push(nodeList[i++]));