微件:External demands:修订间差异
跳转到导航
跳转到搜索
删除的内容 添加的内容
小无编辑摘要 |
小无编辑摘要 |
||
第21行: | 第21行: | ||
cats.forEach((value, key, map) => { |
cats.forEach((value, key, map) => { |
||
console.log(key); |
|||
console.log(value); |
|||
const p = document.createElement('p'); |
const p = document.createElement('p'); |
||
p.innerText = key; |
p.innerText = key; |
2024年4月11日 (四) 07:11的版本
<script>
const elements = document.getElementsByClassName('external_demand_span');
const appendTo = document.getElementById('external_demand');
const cats = new Map();
for (let i = 0; i < elements.length; i++) {
const element = elements[i];
const clone = element.cloneNode(true);
console.log(clone.title);
if (!cats.has(clone.title)) {
cats[clone.title] = new Array();
}
cats[clone.title].push(clone);
clone.style.display = 'inline';
clone.classList.remove('external_demand_span')
}
console.log(cats);
cats.forEach((value, key, map) => {
console.log(key);
console.log(value);
const p = document.createElement('p');
p.innerText = key;
appendTo.appendChild(p);
value.forEach((s) => {
appendTo.appendChild(s);
})
})
</script>